RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

Change page:   |    Displaying page 1 of 3 pages; Items 1 to 20
Title Test Details One Numeric Digit
Expression
^\d$
Description
Matches exactly 1 numeric digit (0-9).
Matches
1 | 2 | 3
Non-Matches
a | 324 | num
Author Rating: The rating for this expression. Steven Smith
Title Test Details Five Integer US ZIP Code
Expression
^\d{5}$
Description
Matches 5 numeric digits, such as a zip code.
Matches
33333 | 55555 | 23445
Non-Matches
abcd | 1324 | as;lkjdf
Author Rating: The rating for this expression. Steven Smith
Title Test Details ZIP+4 - XXXXX-XXXX
Expression
^\d{5}-\d{4}$
Description
Numeric and hyphen 5+4 ZIP code match for ZIP+4.
Matches
22222-3333 | 34545-2367 | 56334-2343
Non-Matches
123456789 | A3B 4C5 | 55335
Author Rating: The rating for this expression. Steven Smith
Title Test Details US ZIP (5 or 5+4)
Expression
^\d{5}$|^\d{5}-\d{4}$
Description
This regular expression will match either a 5 digit ZIP code or a ZIP+4 code formatted as 5 digits, a hyphen, and another 4 digits. Other than that, this is just a really really long description of a regular expression that I'm using to test how my front page will look in the case where very long expression descriptions are used.
Matches
55555-5555 | 34564-3342 | 90210
Non-Matches
434454444 | 645-32-2345 | abc
Author Rating: The rating for this expression. Steven Smith
Title Test Details Any One US ASCII Letter
Expression
^[a-zA-Z]$
Description
Matches any single upper- or lower-case letter.
Matches
a | B | c
Non-Matches
0 | & | AbC
Author Rating: The rating for this expression. Steven Smith
Title Test Details A string of any US ASCII letters
Expression
^[a-zA-Z]+$
Description
Matches any string of only upper- and lower- case letters (no spaces).
Matches
abc | ABC | aBcDeF
Non-Matches
abc123 | mr. | a word
Author Rating: Not yet rated. Steven Smith
Title Test Details Alphanumeric
Expression
^[a-zA-Z0-9]+$
Description
Matches any alphanumeric string (no spaces).
Matches
10a | ABC | A3fg
Non-Matches
45.3 | this or that | $23
Author Rating: Not yet rated. Steven Smith
Title Test Details Positive Integer
Expression
^\d+$
Description
Positive integer value.
Matches
123 | 10 | 54
Non-Matches
-54 | 54.234 | abc
Author Rating: The rating for this expression. Steven Smith
Title Test Details Signed Integer
Expression
^(\+|-)?\d+$
Description
Matches any signed integer.
Matches
-34 | 34 | +5
Non-Matches
abc | 3.1415 | -5.3
Author Rating: The rating for this expression. 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
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: The rating for this expression. 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: The rating for this expression. 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: The rating for this expression. 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: The rating for this expression. 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
^[\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: The rating for this expression. 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: The rating for this expression. 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: The rating for this expression. 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
[\w-]+@([\w-]+\.)+[\w-]+
Description
Yet another simple email validator expression.
Matches
Non-Matches
asdf | 1234
Author Rating: The rating for this expression. Steven Smith
Change page:   |    Displaying page 1 of 3 pages; Items 1 to 20

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials