Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
(AUX|PRN|NUL|COM\d|LPT\d)+\s*$ |
Description |
"Be careful when opening or creating files by using Scripting File System Object. If the filename is based on the user's input, the user might attempt to open a serial port or printer." |
Matches |
COM1 | AUX | LPT1 |
Non-Matches |
image.jpg | index.html | readme.txt |
Author |
Rating:
Not yet rated.
Chris Craft
|
Title |
Test
Details
Pattern Title
|
Expression |
^\$[0-9]+(\.[0-9][0-9])?$ |
Description |
Validates a dollar amount including a dollar sign and 2 decmals. The decimal and cents are optional. |
Matches |
$1.50 | $49 | $0.50 |
Non-Matches |
1.5 | $1.333 | this $5.12 fails |
Author |
Rating:
Not yet rated.
Bob Levittan
|
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 |
\b(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])\b |
Description |
Most Concise RegExp for matching Decimal IPs. If nothing else, it'll make your code easier to read. (And I know that \d?\d is \d{1,2} but that's 2 extra characters.)
--Update: darkone noticed 8 characters could be shaved down. I've edited it to reflect this. Thanks, darkone! |
Matches |
217.6.9.89 | 0.0.0.0 | 255.255.255.255 |
Non-Matches |
256.0.0.0 | 0978.3.3.3 | 65.4t.54.3 |
Author |
Rating:
Sean Schricker
|
Title |
Test
Details
Pattern Title
|
Expression |
^(user=([a-z0-9]+,)*(([a-z0-9]+){1});)?(group=([a-z0-9]+,)*(([a-z0-9]+){1});)?(level=[0-9]+;)?$ |
Description |
This re was used for a security routine. The format is:
[user=name1,name2,...,nameN;][group=group1,group2,...,groupN;][level=number;]
Each component is optional, but they must appear the in order listed if applicable. |
Matches |
user=foo,bar,quux;group=manager,admin;level=100; | group=nobody;level=24; |
Non-Matches |
user=foo | blahh |
Author |
Rating:
Not yet rated.
Michael Scovetta
|
Title |
Test
Details
Pattern Title
|
Expression |
^[0-9]+$ |
Description |
Validate a string to see if it contains a number / integer |
Matches |
1234567890 | 1234567890 | 1234567890 |
Non-Matches |
http://none | http://none | http://none |
Author |
Rating:
Mr M
|
Title |
Test
Details
Pattern Title
|
Expression |
^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$ |
Description |
This RegEx requires a US phone number WITH area code. It is written to all users to enter whatever delimiters they want or no delimiters at all (i.e. 111-222-3333, or 111.222.3333, or (111) 222-3333, or 1112223333, etc...). |
Matches |
(111) 222-3333 | 1112223333 | 111-222-3333 |
Non-Matches |
11122223333 | 11112223333 | 11122233333 |
Author |
Rating:
Laurence O'Donnell
|
Title |
Test
Details
Pattern Title
|
Expression |
^([\w\d\-\.]+)@{1}(([\w\d\-]{1,67})|([\w\d\-]+\.[\w\d\-]{1,67}))\.(([a-zA-Z\d]{2,4})(\.[a-zA-Z\d]{2})?)$ |
Description |
This pattern allows standard e-mail addresses (e.g. [email protected]), sub domains (e.g. [email protected]), the new two- and four-letter domains (e.g. [email protected] and [email protected]) and country codes (e.g. [email protected]). Also, this patter follows the Network Solutions standard length of 67 characters for top-level domains. The reason I allow numbers to be entered in the domain suffix is for future planning. If you do not want numbers to be able to be added as a domain suffix (e.g. [email protected]), simply delete the last two occurrences of "\d". |
Matches |
|
Non-Matches |
|
Author |
Rating:
Not yet rated.
Laurence O'Donnell
|
Title |
Test
Details
Pattern Title
|
Expression |
^(\d{4}[- ]){3}\d{4}|\d{16}$ |
Description |
Credit card validator. Just checks that the format is either 16 numbers in groups of four separated by a "-" or a " " or nothing at all. |
Matches |
1234-1234-1234-1234 | 1234 1234 1234 1234 | 1234123412341234 |
Non-Matches |
Visa | 1234 | 123-1234-12345 |
Author |
Rating:
Not yet rated.
Steven 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 |
^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$ |
Description |
Matches major credit cards including:
Visa (length 16, prefix 4), Mastercard (length 16, prefix 51-55), Discover (length 16, prefix 6011), American Express (length 15, prefix 34 or 37). All 16 digit formats accept optional hyphens (-) between each group of four digits. |
Matches |
6011-1111-1111-1111 | 5423-1111-1111-1111 | 341111111111111 |
Non-Matches |
4111-111-111-111 | 3411-1111-1111-111 | Visa |
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 |
[\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 |
^[\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 |
^[12345]$ |
Description |
This matches a single numeric digit between 1 and 5, and is the same as saying ^[1-5]$. |
Matches |
1 | 2 | 4 |
Non-Matches |
6 | -1 | abc |
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^[1-5]$ |
Description |
This matches a single numeric digit between 1 and 5, and is the same as saying ^[12345]$. |
Matches |
1 | 3 | 4 |
Non-Matches |
6 | 23 | a |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
foo |
Description |
The "hello world" of regular expressions, this will match any string with an instance of 'foo' in it. |
Matches |
foo |
Non-Matches |
bar |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Date With Slashes
|
Expression |
^\d{1,2}\/\d{1,2}\/\d{4}$ |
Description |
This regular expressions matches dates of the form XX/XX/YYYY where XX can be 1 or 2 digits long and YYYY is always 4 digits long. |
Matches |
4/1/2001 | 12/12/2001 | 55/5/3434 |
Non-Matches |
1/1/01 | 12 Jan 01 | 1-1-2001 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Email - Overly Simple
|
Expression |
^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$ |
Description |
Simple email expression. Doesn't allow numbers in the domain name and doesn't allow for top level domains that are less than 2 or more than 3 letters (which is fine until they allow more). Doesn't handle multiple "." in the domain ( [email protected]). |
Matches |
|
Non-Matches |
|
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Strongish Password
|
Expression |
^[a-zA-Z]\w{3,14}$ |
Description |
The password's first character must be a letter, it must contain at least 4 characters and no more than 15 characters and no characters other than letters, numbers and the underscore may be used |
Matches |
abcd | aBc45DSD_sdf | password |
Non-Matches |
afv | 1234 | reallylongpassword |
Author |
Rating:
Not yet rated.
Steven Smith
|
Displaying page
of
pages;
Items to