Welcome To Snipplr


Everyone's Recent Snippets Tagged regex



1 ... 4 5 6 7 8
0 2474 posted 17 years ago by troynt
Will return a string that has any matched URLs wrapped in `<a>` tags. Example: `"This is a link to http://foobar.com . Please visit !"` Becomes: `"This is a link to <a href='http://foobar.com'>http://foobar.com</a> . Please visit!"` Note: Op...
2 6664 posted 17 years ago by jasonseney
I know it's a very quick & simple Regex, but someone from work need it so I thought I should also put it here
1 1802 posted 17 years ago by cristianciofu
This function clean up phone number and present it in styled way.
9 3126 posted 17 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 2914 posted 17 years ago by gdvickery
0 1834 posted 17 years ago by troynt
1 3067 posted 17 years ago by wizard04
This helps you stip anything from title. This example is from Symfony homepage.
0 1273 posted 17 years ago by Zver
This email snippet was borrowed from (FlashJunior), the original snippit is: http://snipplr.com/view/7743/email-check/
0 1401 posted 17 years ago by binarynomad
Escape all special regex characters (.*+?|()[]{}\) from a string. Useful when dynamically building a Regular Expression object based on input text that could hold regex characters.
2 2559 posted 17 years ago by kouphax
similar to php ereg_replace. You can pass this pattern [^A-Za-z0-9] and "" to remove from string non alphanumerical chars: s = ereg_replace("[^A-Za-z0-9]","",s) I use this function to clean input fields...
0 2077 posted 17 years ago by ginoplusio
US phone with or without parentheses
1 1776 posted 17 years ago by binarynomad
Search for Social Security Numbers
1 1589 posted 17 years ago by binarynomad
1 1846 posted 17 years ago by mamoo
This regular expression matches any trailing whitespace at the end of a line (whitespace and tabs). Replace this with nothing to remove trailing whitespace from files.
1 2221 posted 17 years ago by kouphax
1 3163 posted 17 years ago by Bonky
1 3959 posted 17 years ago by jamarama
If you have a title, for something like a blog or product, and want to make an seo-friendly name to call it, here is a function. SAMPLE INPUT: $title = "This foo's bar is rockin' cool!"; echo make_seo_name($title); //RETURNS: //this-foos-bar-i...
10 4219 posted 17 years ago by jdstraughan
(Created for JavaScript) These are rather forgiving. Spaces, dashes, or periods are allowed as separators. Extensions can be recognized by several strings (#, x, x., ext, ext., extension). Area code: $1$2 Exchange code: $3 Station code: $...
1 2776 posted 18 years ago by wizard04
Matches single line Javascript (and PHP, etc.) comments
1 1684 posted 18 years ago by mikegreen
Matches CSS-style comments spanning one or multiple lines
2 2462 posted 18 years ago by mikegreen
0 1879 posted 18 years ago by zingo
This will count sentences that end in . or ? or ! and have a space after them.
1 3489 posted 18 years ago by evanwalsh
1 ... 4 5 6 7 8