Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged regex



« Prev 1 2
Search and returns the first results on a regex search If we use parenthesized or subpattern, can return with $result_number
0 1462 posted 10 years ago by jatubio
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)
0 2551 posted 10 years ago by jatubio
Replaces spaces by '\s+' which means one or more spaces $string can be one string or one array of strings
0 1445 posted 10 years ago by jatubio
**Example of use:** if (!isUniversityEmail('[email protected]')) exit('You must have a valid and .edu email address to register for an account.');
1 2710 posted 12 years ago by phpdev
I want to extract the numbers from a string that contains numbers and letters like
0 3002 posted 12 years ago by satie83
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...
0 2681 posted 13 years ago by halk
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...
0 2325 posted 13 years ago by pumpkinthehead
Replaces all links within href part of anchor in a HTML-String.
1 6192 posted 13 years ago by rwunsch
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
0 3151 posted 14 years ago by jmiller
Useful when using user-submitted URLs
0 1146 posted 14 years ago by Entherman
0 1437 posted 14 years ago by resting
A really handy snippet that will replace textual URLs with HTML links. Also works for email addresses.
0 2126 posted 14 years ago by plesh
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.
0 2384 posted 14 years ago by nebojsac
Full email validation with regex.
0 3109 posted 14 years ago by nebojsac
Returns the video id for any type of youtube url that holds one.
2 2190 posted 14 years ago by KabuqueJoe
1 1284 posted 14 years ago by metoikos
Youtube ID simple extractor
1 1321 posted 15 years ago by jhonqwerty
useful in conjunction with curl and examining headers
0 1474 posted 15 years ago by thiswayup
0 1400 posted 15 years ago by traeregan
I\'ve added an additional case to handle videos linked from a user\'s channel.
2 2409 posted 15 years ago by Jamie
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/
3 2303 posted 15 years ago by keevkilla
0 1355 posted 15 years ago by metoikos
this function return associative array from SERVER_SOFTWARE
1 1637 posted 15 years ago by naz
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
1 3856 posted 16 years ago by Gustavs
4 3891 posted 16 years ago by fackz
0 1060 posted 16 years ago by kokikr
This function clean up phone number and present it in styled way.
9 2587 posted 16 years ago by naz
These 4 lines of code can be used to extract and return all links from any page using regex patterns. If links are found, an array is returned, else boolean false is returned.
4 2305 posted 16 years ago by gdvickery
« Prev 1 2