Displaying page
of
pages;
Items to
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 |
(\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{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 |
^((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 |
^.{4,8}$
|
Description |
Matches any string between 4 and 8 characters in length. Limits the length of a string. Useful to add to password regular expressions.
|
Matches |
asdf | 1234 | asdf1234
|
Non-Matches |
asd | 123 | asdfe12345
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^\d*$
|
Description |
Accepts an unsigned integer number. Also matches empty strings.
|
Matches |
123 | 000 | 43
|
Non-Matches |
asbc | -34 | 3.1415
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^[-+]?\d*$
|
Description |
Matches any integer number or numeric string, including positive and negative value characters (+ or -). Also matches empty strings.
|
Matches |
123 | -123 | +123
|
Non-Matches |
abc | 3.14159 | -3.14159
|
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^\d*\.?\d*$
|
Description |
Matches any unsigned floating point number/numeric string. Also matches empty strings.
|
Matches |
123 | 3.14159 | .234
|
Non-Matches |
abc | -3.14159 | 3.4.2
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^[-+]?\d*\.?\d*$
|
Description |
Matches any floating point numer/numeric string, including optional sign character (+ or -). Also matches empty strings.
|
Matches |
123 | +3.14159 | -3.14159
|
Non-Matches |
abc | 3.4.5 | $99.95
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^\d{9}[\d|X]$
|
Description |
A very simple ISBN validation expression - it just checks for a 10 digit number where the last digit could also be a capital 'X'. Complete specs for ISBN available here:
http://www.isbn.org/standards/home/isbn/international/html/usm4.htm. An enhancement would be to allow exactly 3 or 0 hyphens or 3 or 0 spaces, since these are also valid formats.
|
Matches |
1234123412 | 123412341X
|
Non-Matches |
not an isbn
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^(20|21|22|23|[0-1]\d)[0-5]\d$
|
Description |
This regular expression will match a 24 hour time with no separators.
|
Matches |
1200 | 1645 | 2359
|
Non-Matches |
2400 | asbc | 12:45
|
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^( [1-9]|[1-9]|0[1-9]|10|11|12)[0-5]\d$
|
Description |
Matches a 12-hour time value expressed as either 4 numeric digits, 3 numeric digits, or a space and 3 numeric digits. 3 digit times (930) can be expressed with leading 0's (0930) or not. AM/PM designation is not included in this expression.
|
Matches |
1145 | 933 | 801
|
Non-Matches |
0000 | 1330 | 8:30
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^(|(0[1-9])|(1[0-2]))\/((0[1-9])|(1\d)|(2\d)|(3[0-1]))\/((\d{4}))$
|
Description |
This expression matches dates formatted as MM/DD/YYYY where months and days must be 2 digits each, zero padded. It is not perfect - it allows DD to be from 01 to 31 regardless of the month.
|
Matches |
01/01/2001 | 02/30/2001 | 12/31/2002
|
Non-Matches |
1/1/02 | 1/1/2002 | 1/25/2002
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^((((0[13578])|(1[02]))[\/]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\/]?(([0-2][0-9])|(30)))|(02[\/]?[0-2][0-9]))[\/]?\d{4}$
|
Description |
Date expressions that matches MM/DD/YYYY where MM and DD must be two digits and zero padded. Validates correctly for all months except February, which it assumes to always have 29 days. The "/" separator is optional.
|
Matches |
01/01/2001 | 02/29/2002 | 12/31/2002
|
Non-Matches |
1/1/02 | 02/30/2002 | 1/25/2002
|
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^[-+]?\d+(\.\d+)?$
|
Description |
This matches any real number, with optional decimal point and numbers after the decimal, and optional positive (+) or negative (-) designation.
|
Matches |
123 | -123.45 | +123.56
|
Non-Matches |
123x | .123 | -123.
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
[A-Z][a-z]+
|
Description |
This expression was developed to match the Title cased words within a Camel cased variable name. So it will match 'First' and 'Name' within 'strFirstName'.
|
Matches |
strFirstName | intAgeInYears | Where the Wild Things Are
|
Non-Matches |
123 | abc | this has no caps in it
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
\.com/(\d+)$
|
Description |
This is a regex I wrote to capture requests to AspAlliance.com with an article id as the only thing after the domain. So http://aspalliance.com/123 would go to article number 123. It maps the URL to the actual aspx file that displays the article based on the ID.
|
Matches |
http://aspalliance.com/123 | www.aspalliance.com/123 | http://aspalliance.com/34
|
Non-Matches |
http://aspalliance.com/article.aspx?id=123 | http://aspalliance.com/ | http://aspalliance.com/articl
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^DOMAIN\\\w+$
|
Description |
In response to a question on the regex list at www.aspadvice.com, this expression should ensure that a login field's username includes a 'DOMAIN\' prefix. The latter part of the expression should probably be limited so that it only allows usernames of appropriate lengths, perhaps 3 to 20 characters (by replacing + with {3,20} for instance).
|
Matches |
DOMAIN\ssmith | DOMAIN\a | DOMAIN\username
|
Non-Matches |
ssmith | username | DOMAIN\
|
Author |
Rating:
Not yet rated.
Steven Smith
|
Displaying page
of
pages;
Items to