Displaying page
of
pages;
Items to
| Title |
Test
Details
Pattern Title
|
| Expression |
([\d\w-.]+?\.(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|f[ijkmnor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eouw]|s[abcdeghijklmnortuvyz]|t[cdfghjkmnoprtvwz]|u[augkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|pro)(\b|\W(?<!&|=)(?!\.\s|\.{3}).*?))(\s|$) |
| Description |
This will find URLs in plain text. With or without protocol. It matches against all toplevel domains to find the URL in the text. |
| Matches |
http://www.website.com/index.html | www.website.com | website.com |
| Non-Matches |
Works in all my tests. Does not capture protocol. |
| Author |
Rating:
James Johnston
|
| Title |
Test
Details
Pattern Title
|
| Expression |
<a\s*href=(.*?)[\s|>] |
| Description |
Retrieves all anchor links in a html document, useful for spidering. You will need to do a replace of " and ' after the regular expression, as the expression gets all links. As far as I know there is no way, even with \1 groupings, of getting a condition on whether the link contains a ",' or nothing at all (" and ' is easy enough, but what happens if the link starts with ", and has a javascript function call with a string in it). If there is, it's probably quicker to do it like this and do a string replace anyway. |
| Matches |
<a href="http://www.blah.com"> | <a href='../blah.html' target="_top"&a |
| Non-Matches |
<a href = http://www.idiothtmlprogrammers.com > |
| Author |
Rating:
chris s
|
| Title |
Test
Details
Single Email Match - current June 2010
|
| Expression |
^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+(?:[a-zA-Z]{2}|aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel)$ |
| Description |
Matches email addresses. Based on expression at regular-expressions.info/email.html modified to include all top-level domains (TLD)listed on wikipedia as of June 2010. Needs to be updated as new TLDs are added.
Known Issues:
* IP Addresses will not validate
* Double "at" symbols, e.g. email@em@il.com slip by this regex. Would welcome improvements by a regex ninja. |
| Matches |
email@email.com | email@email.cn | e_m81l&em%'l@eMail.MUSEUM | email@em@il.com |
| Non-Matches |
email@com | email@email.con | email@email.museet | email@192.0.0.1 |
| Author |
Rating:
Not yet rated.
Brent Thomas
|
| Title |
Test
Details
International & Domestic Phone Numbers with Ext
|
| Expression |
^([\+][0-9]{1,3}([ \.\-])?)?([\(]{1}[0-9]{3}[\)])?([0-9A-Z \.\-]{1,32})((x|ext|extension)?[0-9]{1,4}?)$ |
| Description |
Somewhat conservative expression for evaluating phone numbers. Based off ideas found at http://stackoverflow.com/questions/123559/a-comprehensive-regex-for-phone-number-validation this allows country codes, with or without the + symbol, area codes surrounded by parenthesis (or not) and numbers delimited by spaces, periods or dashes. You'll want to independently test for string length based on your needs. |
| Matches |
(123)456-7890 | (123)456-7890 x123 | +1 (123)456-7890 | 12 3456 789 0 x1234 | (123)456-7890x123 |(123)456-7890ext123 | (123)456-7890 extension123 | 123.456.7890 | 1234567890 | 1234567 | 12 34 56 78 90 | 12 3 4567 890123 x4567 | +12 3456 7890 | +12 34 56 7890 | +12 3456 7890 | +12 34567890 |
| Non-Matches |
(123)456-7890 x 123 | 123.45.6.78+90 |
| Author |
Rating:
Not yet rated.
Brent Thomas
|
| Title |
Test
Details
Date Match
|
| Expression |
^(d{0}|(31(?!(FEB|APR|JUN|SEP|NOV)))|((30|29)(?!FEB))|(29(?=FEB(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(29(?=FEB(((0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8])(JAN|FEB|MAR|MAY|APR|JUL|JUN|AUG|OCT|SEP|NOV|DEC)((1[6-9]|[2-9]\d)\d{2}|\d{2}|d{0})$ |
| Description |
This pattern mathces the following date formats: DDMMMYY,DDMMMYYYY,DDMMMYY. The Pattern matches on leap year dates as well |
| Matches |
12MAR02 | 12MAR2008 | 29FEB2008 | 12MAR |
| Non-Matches |
29FEB2007 | 32MAR | 00APR |
| Author |
Rating:
Ole
|
| Title |
Test
Details
Scientific Notation
|
| Expression |
^(-?[1-9](\.\d+)?)((\s?[X*]\s?10[E^]([+-]?\d+))|(E([+-]?\d+)))$ |
| Description |
Matches both normalized and E notations, with or without spaces or negative numbers. Make sure to use a case insensitive pattern matcher. Group 1 is the significand, and either group 5 or group 7 is the exponent (one or the other will be null, but never both). |
| Matches |
1.1 x 10^9 | 2.34 X 10^12 | 3.14159 * 10^30 | 1.1x10^9 | 2.34X10^12 | 3.14159*10^30 | 1.1 x 10e9 | 2.34 x 10E12 | 3.14159e30 | 1.1 x 10^-9 | 2.34 X 10^-12 | 3.14159E-30 | -1.1 x 10^9 | -2.34 X 10E12 | -3.14159 * 10e30 | -1.1x10^-9 | -2.34E-12 | -3.14159e-30 | 3.1459E+030 | 1x10^9 | 1E9 |
| Non-Matches |
0.1 x 10^9 | 23.4 x 10^12 | 3.14159 * 10e^30 | 1.1e8.3 |
| Author |
Rating:
Jared Cook
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(\d{4}-){3}\d{4}$|^(\d{4} ){3}\d{4}$|^\d{16}$ |
| Description |
Used to validate Credit Card numbers, Checks if it contains 16 numbers in groups of 4 separated by -, ,or nothing |
| Matches |
1111-2323-2312-3434 | 1234343425262837 | 1111 2323 2312 3434 |
| Non-Matches |
1111 2323 2312-3434 | 34323423 | 1111-2323-23122-3434 |
| Author |
Rating:
Sachin Bhatt
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([a-zA-Z '-]+)$ |
| Description |
Check if the text is a valid firstname or lastname.It allows Characters,'- and space only |
| Matches |
Sachin Bhatt | D'Souza | Ul-Haq |
| Non-Matches |
sac2hin | sc*& | sac)in |
| Author |
Rating:
Sachin Bhatt
|
| Title |
Test
Details
Number
|
| Expression |
^\s*[+-]?\s*(?:\d{1,3}(?:(,?)\d{3})?(?:\1\d{3})*(\.\d*)?|\.\d+)\s*$ |
| Description |
Matches numbers. May include decimals, thousands separators, and sign. |
| Matches |
5,000 | - 10 | .1 |
| Non-Matches |
7.000.000 | 5,0000 | 1.000,000 |
| Author |
Rating:
Not yet rated.
mark
|
| Title |
Test
Details
AW Short Coordinate
|
| Expression |
^[0-9]+[NnSs] [0-9]+[WwEe]$ |
| Description |
This tests, are entered AW coordinates in correct short format, and it has no world info |
| Matches |
0N 0W |
| Non-Matches |
aw 0N 0W |
| Author |
Rating:
Slysoft
|
| Title |
Test
Details
Allow Decimal only
|
| Expression |
^\d*[0-9](|.\d*[0-9]|)*$ |
| Description |
Decimal like 123.23
123.1234
12345.456 |
| Matches |
123.23 | 123.1234 | 1234 | 1234.456 |
| Non-Matches |
123a.12 | 123.34d | abc |
| Author |
Rating:
Gyanendra
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(?s)( class=\w+(?=([^<]*>)))|(<!--\[if.*?<!\[endif\]-->)|(<!\[if !\w+\]>)|(<!\[endif\]>)|(<o:p>[^<]*</o:p>)|(<span[^>]*>)|(</span>)|(font-family:[^>]*[;'])|(font-size:[^>]*[;'])(?-s) |
| Description |
Word HTML cleanup code. Use this expression to get rid of most of the stuff that Word adds to an HTML document such as: lots of span elements, font-family and font-size style attributes, class attributes, a whole bunch of if-then statements. Use this expression in a regex.replace(originalHtml, regExpr, "").
|
| Matches |
<span> |
| Non-Matches |
<table> |
| Author |
Rating:
Peter Donker
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*.*))+\.((html|HTML)|(htm|HTM))$ |
| Description |
Path of files HTML and HTM |
| Matches |
c:\arquivo.html | \\home\arquivo232.HTML | Z:\teste.htm |
| Non-Matches |
c:\arquivo.png | arquivo232.HTML | Z:\teste |
| Author |
Rating:
Diego Siebra Ferreira
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(?=.*[0-9]+.*)(?=.*[a-zA-Z]+.*)[0-9a-zA-Z]{6,}$ |
| Description |
Password must contain at least one letter, at least one number, and be longer than six charaters. |
| Matches |
a1b2c3 | abcdefg123 | 12345a |
| Non-Matches |
abcdefghij | 1234567890 |
| Author |
Rating:
Eric Miller
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^((?-i:0x)?[A-Fa-f0-9]{32}|
[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}|
\{[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}\})$ |
| Description |
Validates a GUID/UUID, without capture, to the following patterns: [{hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh}],
[hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh],[hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh],[0xhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh], where 'h' is a valid hex character. This last pattern is a binary format commonly used with SQL Server 2000. It allows you to use binary(n) and varbinary(n) parameters that convert well to unique identifier. Please note that this is not case sensitive EXCEPT the 'x' in the binary pattern. It must be lower case. |
| Matches |
6F9619FF-8B86-D011-B42D-00C04FC964FF | 0x6F9619FF8B86D011B42D00C04FC964FF | {6F9619FF-8B86-D011-B42D |
| Non-Matches |
{6F9619FF8B86D011B42D00C04FC964FF} | 0X6F9619FF8B86D011B42D00C04FC964FF |
| Author |
Rating:
Patrick Fogarty
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[\w\.=-]+@[\w\.-]+\.[\w]{2,3}$ |
| Description |
Much simpler email expression. This one forces a length of 2 or 3, which fits current specs, but you may need to alter the end as this one allows all numerals on the .COM section. |
| Matches |
a@a.com | a@a.com.au | a@a.au |
| Non-Matches |
word | word@ | @word |
| Author |
Rating:
Gregory Beamer
|
| Title |
Test
Details
Head Parser
|
| Expression |
(<meta [.\w\W]*?\>)|(<style [.\w\W]*?</style>)|(<link [.\w\W]*?\>)|(<script [.\w\W]*?</script>) |
| Description |
Parses the objects out from an html header. These objects are: meta, style, link, and script. Use with the multiline option to pull from multine scripts and styles. |
| Matches |
<head runat="server"> <title></title> <script type="text/javascript"> // // function foo() { } // </script> <style type="text/css"> /* ** ** */ .foo { font-size : large;} </style> <script src="includes/JScript1.js" type="text/javascript"></script> <link href="includes/Stylesheet1.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> // // function foo2() { } // </script> <style type="text/css"> /* ** |
| Non-Matches |
Um.... |
| Author |
Rating:
Tim Cartwright
|
| Title |
Test
Details
Social Security Number - All Rules Enforced
|
| Expression |
^((?!000)(?!666)([0-6]\d{2}|7[0-2][0-9]|73[0-3]|7[5-6][0-9]|77[0-1]))-((?!00)\d{2})-((?!0000)\d{4})$ |
| Description |
Could not find a regex that truly matched the rules here http://en.wikipedia.org/wiki/Social_Security_number#Valid_SSNs So I modified an existing one to match the valid SSN rules.
The first digit set will not match:
000, 666, 734 to 749, and greater than 772.
* Numbers with all zeros in any digit group (000-xx-####, ###-00-####, ###-xx-0000) |
| Matches |
455-55-4444|333-22-1111|733-11-1111 |
| Non-Matches |
734-11-1111|749-11-1111|772-11-1111 |
| Author |
Rating:
Tim Cartwright
|
| Title |
Test
Details
Querystring Parse
|
| Expression |
(?<=[\?|\&])(?<key>[^\?=\&\#]+)=?(?<value>[^\?=\&\#]*) |
| Description |
I wrote this to parse the querystring into its key value parts. It will also match querystring keys without an associated value.
For a nice url parser, look at this one http://regexlib.com/REDetails.aspx?regexp_id=628 |
| Matches |
http://www.foo.com/page.aspx?qs1=true&test=foo&bar=true&test#blah |
| Non-Matches |
http://www.foo.com/page.aspx |
| Author |
Rating:
Tim Cartwright
|
| Title |
Test
Details
Pattern Title
|
| Expression |
/[^/]+$ |
| Description |
Very easy expression to get the file name from a path. I couldn't find it so I wrote it and now I post it here! Hope it could help. |
| Matches |
/home/pietro/myfile.txt | /home/pietro/myfile |
| Non-Matches |
/home/pietro/mydir/ |
| Author |
Rating:
Pietro Bonfa
|
Displaying page
of
pages;
Items to