Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged regex



« Prev 1 2
  1. FAV

    Search and returns the first results on a regex search

    Search and returns the first results on a regex search If we use parenthesized or subpattern, can return with $result_number
    PHP 3 views posted 4 years ago by jatubio
  2. FAV

    Create a regex expression with operator 'AND'

    Build a regex expression to all array elements are present in any order. Gets an array of strings (Sample: array("Access Denied","error","could not be retrieved") Return sample: '(?=.*Access Denied)(?=.*error)(?=.*could not be retrieved)
    PHP 2 views posted 5 years ago by jatubio
  3. FAV

    // Search multiple spaces with regex expressions

    Replaces spaces by '\s+' which means one or more spaces $string can be one string or one array of strings
    PHP 3 views posted 5 years ago by jatubio
  4. FAV

    Check University Email (.edu)

    **Example of use:** if (!isUniversityEmail('[email protected]')) exit('You must have a valid and .edu email address to register for an account.');
    PHP saved by 4 people 29 views posted 6 years ago by phpdev
  5. FAV

    PHP - Extract numbers from a string

    I want to extract the numbers from a string that contains numbers and letters like
    PHP 12 views posted 6 years ago by satie83
  6. FAV

    Regex Clipboard Class (Mini-Template Engine)

    https://gist.github.com/4098493 (examples of use below the class code) This class allows you to load a file of snippets that are really mini-templates copy them from your repository fill the token slots in them the with your data and render them as...
    PHP 11 views posted 7 years ago by halk
  7. FAV

    Remove superfluous line breaks between HTML elements.

    A regular expression for removing <br> and <br> (case insensitive) between HTML elements if there is no content between the HTML elements. It was written for fixing extra line spaces created in a WordPress visual editor after the content of the visu...
    PHP 4 views posted 7 years ago by pumpkinthehead
  8. FAV

    Remove / Replace - href / anchor /link - in html /string - preg_replace - php - regex - regular expression

    Replaces all links within href part of anchor in a HTML-String.
    PHP saved by 3 people 15 views posted 7 years ago by rwunsch
  9. FAV

    Get YouTube Video ID [Very robust]

    This will get the 11-character YouTube video ID from any valid YouTube URL. Based on http://snipplr.com/view/57065/get-youtube-video-id/ but made more robust to handle additional URL inputs
    PHP 21 views posted 8 years ago by jmiller
  10. FAV

    Loop through $_REQUEST matching a parameter starting xxxxxx.....

    PHP 2 views posted 8 years ago by flatearthcomms
  11. FAV

    Clean User Submitted URL's

    Useful when using user-submitted URLs
    PHP 0 views posted 8 years ago by Entherman
  12. FAV

    Regex Trim Whitespace

    PHP 1 views posted 8 years ago by resting
  13. FAV

    Replace URLs with links - PHP

    A really handy snippet that will replace textual URLs with HTML links. Also works for email addresses.
    PHP 12 views posted 8 years ago by plesh
  14. FAV

    Activate Links in String PHP

    Returns the same string, except with links wrapped in <a href=""> tags. Works on www.snipplr.com and on http://snipplr.com A variation of the script on the attached URL.
    PHP 0 views posted 8 years ago by nebojsac
  15. FAV

    Email Validation PHP Regex

    Full email validation with regex.
    PHP 8 views posted 8 years ago by nebojsac
  16. FAV

    youtube url video id

    Returns the video id for any type of youtube url that holds one.
    PHP saved by 10 people 6 views posted 8 years ago by KabuqueJoe
  17. FAV

    Regular Expression for URLs using ereg_replace

    PHP 3 views posted 9 years ago by adampatterson
  18. FAV

    regular expression examples

    PHP saved by 1 person 0 views posted 9 years ago by metoikos
  19. FAV

    Youtube ID extractor

    Youtube ID simple extractor
    PHP saved by 2 people 2 views posted 9 years ago by jhonqwerty
  20. FAV

    exploding a string by line breaks accounting for cross platform

    useful in conjunction with curl and examining headers
    PHP 4 views posted 9 years ago by thiswayup
  21. FAV

    Remove Non Numeric Characters

    PHP 3 views posted 9 years ago by traeregan
  22. FAV

    Youtube Video ID Regex & PHP Function

    I\'ve added an additional case to handle videos linked from a user\'s channel.
    PHP saved by 6 people 6 views posted 9 years ago by Jamie
  23. FAV

    Improvement of URL interpretation with regex

    A source to help you interpreting URLs in plain text as a HTML link. It's an improvement of what was proposed here : http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/
    PHP saved by 9 people 9 views posted 9 years ago by keevkilla
  24. FAV

    php text to link

    PHP 1 views posted 9 years ago by metoikos
  25. FAV

    Get Apache Version and other installed software versions as associative array

    this function return associative array from SERVER_SOFTWARE
    PHP saved by 3 people 5 views posted 9 years ago by naz
  26. FAV

    Regular Expression to get contents of div[id]

    This allows you to get contents of any div with ID tag. $matches[0] returns with parent div tag $matches[1] returns with out parent div tag
    PHP saved by 2 people 3 views posted 10 years ago by Gustavs
  27. FAV

    Useful regex functions

    PHP saved by 8 people 22 views posted 10 years ago by fackz
  28. FAV

    regexp match tide data

    PHP 1 views posted 10 years ago by kokikr
  29. FAV

    Regex Text Syntax Parser

    Parse syntax in a text using preg_replace_callback.
    PHP saved by 8 people 4 views posted 10 years ago by caioariede
  30. FAV

    Phone number beutifier

    This function clean up phone number and present it in styled way.
    PHP saved by 27 people 11 views posted 10 years ago by naz
« Prev 1 2