Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
^[a-zA-Z0-9\-\.]+\.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU)$ |
Description |
Domain names:
This regular expression tests the validity of a domain or hostname. It will match any valid domain name that does not contain characters which are invalid in URLs, and which ends in .com, .org, .net, .mil, or .edu. You can add additional valid TLDs by appending the | (pipe) character and the desired TLD to the list in the parens. |
Matches |
3SquareBand.com | asp.net | army.mil |
Non-Matches |
$SquareBand.com | asp/dot.net | army.military |
Author |
Rating:
Not yet rated.
G. Andrew Duthie
|
Title |
Test
Details
Pattern Title
|
Expression |
^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$ |
Description |
Email validator that adheres directly to the specification for email address naming. It allows for everything from ipaddress and country-code domains, to very rare characters in the username. |
Matches |
|
Non-Matches |
joe | @foo.com | a@a |
Author |
Rating:
Andy Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4} |
Description |
US Phone Number -- doesn't check to see if first digit is legal (not a 0 or 1). |
Matches |
(123) 456-7890 | 123-456-7890 |
Non-Matches |
1234567890 |
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
[\w-]+@([\w-]+\.)+[\w-]+ |
Description |
Yet another simple email validator expression. |
Matches |
|
Non-Matches |
asdf | 1234 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
\d{4}-?\d{4}-?\d{4}-?\d{4} |
Description |
Major credit card validator. Only checks that the format is 16 digits (optionally separated by hyphens), not the value of any of the digits. |
Matches |
1234-1234-1234-1234 | 1234123412341234 |
Non-Matches |
1234123412345 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?=.*\d).{4,8}$ |
Description |
Password expression. Password must be between 4 and 8 digits long and include at least one numeric digit. |
Matches |
1234 | asdf1234 | asp123 |
Non-Matches |
asdf | asdf12345 | password |
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$ |
Description |
Password matching expression. Password must be at least 4 characters, no more than 8 characters, and must include at least one upper case letter, one lower case letter, and one numeric digit. |
Matches |
asD1 | asDF1234 | ASPgo123 |
Non-Matches |
asdf | 1234 | ASDF12345 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$ |
Description |
RegExp for validating the format of IP Addresses. This works great with the ASP.NET RegularExpressionValidator server control. |
Matches |
127.0.0.1 | 255.255.255.0 | 192.168.0.1 |
Non-Matches |
1200.5.4.3 | abc.def.ghi.jkl | 255.foo.bar.1 |
Author |
Rating:
G. Andrew Duthie
|
Title |
Test
Details
Pattern Title
|
Expression |
(\w+)\s+\1 |
Description |
This expression uses a BackReference to find occurrences of the same word twice in a row (separated by a space).
Matches things like 'mandate dated', which may not be desirable. See Sean Carley's update for a better expression for true repeated word matching. |
Matches |
hubba hubba | mandate dated | an annual |
Non-Matches |
may day | gogo | 1212 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^\d{5}-\d{4}|\d{5}|[A-Z]\d[A-Z] \d[A-Z]\d$ |
Description |
This expression matches three different formats of postal codes: 5 digit US ZIP code, 5 digit US ZIP code + 4, and 6 digit alphanumeric Canadian Postal Code. The first one must be 5 numeric digits. The ZIP+4 must be 5 numeric digits, a hyphen, and then 4 numeric digits. The Canadian postal code must be of the form ANA NAN where A is any uppercase alphabetic character and N is a numeric digit from 0 to 9. |
Matches |
44240 | 44240-5555 | G3H 6A3 |
Non-Matches |
Ohio | abc | g3h6a3 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^[2-9]\d{2}-\d{3}-\d{4}$ |
Description |
This expression matches a hyphen separated US phone number, of the form ANN-NNN-NNNN, where A is between 2 and 9 and N is between 0 and 9. |
Matches |
800-555-5555 | 333-444-5555 | 212-666-1234 |
Non-Matches |
000-000-0000 | 123-456-7890 | 2126661234 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$ |
Description |
This expression matches email addresses, and checks that they are of the proper form. It checks to ensure the top level domain is between 2 and 4 characters long, but does not check the specific domain against a list (especially since there are so many of them now). |
Matches |
|
Non-Matches |
a@b | notanemail | joe@@. |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
\(([0-9]{2}|0{1}((x|[0-9]){2}[0-9]{2}))\)\s*[0-9]{3,4}[- ]*[0-9]{4} |
Description |
Match diferent styles for brazilian Phone number code.
Only DDD (12), complete DDD (012), complete DDD + Telephony Company (0xx12) plus 3 or 4 digits (city code) plus 4 digits (phone number). |
Matches |
(12) 123 1234 | (01512) 123 1234 | (0xx12) 1234 1234 |
Non-Matches |
12 123 1234 | (012) 123/1234 | (012) 123 12345 |
Author |
Rating:
Samuel Mota
|
Title |
Test
Details
Pattern Title
|
Expression |
^\w+[\w-\.]*\@\w+((-\w+)|(\w*))\.[a-z]{2,3}$ |
Description |
Email validation. With this short expression you can validate for proper email format. It's short and accurate. |
Matches |
|
Non-Matches |
|
Author |
Rating:
Eric Lebetsamer
|
Title |
Test
Details
Pattern Title
|
Expression |
^#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$ |
Description |
Tests for valid HTML hexadecimal color codes. The # symbol is optional. And it will except either the 3 digit form for the 216 Web safe colors, or the full 6 digit form. I am use it on my site to allow users to customize the site's colors. |
Matches |
#00ccff | #039 | ffffcc |
Non-Matches |
blue | 0x000000 | #ff000 |
Author |
Rating:
Chris Craft
|
Title |
Test
Details
Pattern Title
|
Expression |
/\*[\d\D]*?\*/ |
Description |
If you need to extract or remove any /* */ sytle comments from any Java, JavaScript, C, C++, CSS, etc code you have this regular expression can help. |
Matches |
/* my comment */ | /* my multiline comment */ | /* my nested comment */ |
Non-Matches |
*/ anything here /* | anything between 2 seperate comments | \* *\ |
Author |
Rating:
Chris Craft
|
Title |
Test
Details
Pattern Title
|
Expression |
^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$ |
Description |
Matches UK postcodes according to the following rules
1. LN NLL eg N1 1AA
2. LLN NLL eg SW4 0QL
3. LNN NLL eg M23 4PJ
4. LLNN NLL eg WS14 0JT
5. LLNL NLL eg SW1N 4TB
6. LNL NLL eg W1C 8LQ
Thanks to Simon Bell for informing me of LNL NLL rule for postcodes which I had omitted in an earlier version.
|
Matches |
G1 1AA | EH10 2QQ | SW1 1ZZ |
Non-Matches |
G111 1AA | X10 WW | DDD 5WW |
Author |
Rating:
Not yet rated.
Dave Sparks
|
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 |
|
Non-Matches |
word | word@ | @word |
Author |
Rating:
Gregory Beamer
|
Displaying page
of
pages;
Items to