104 regular expressions found in this category!
Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
^[0-9]{6} |
Description |
I know its simple, yet there was no Russian postal code regular expression on the RegExLib. Just in case some needs to know the format. |
Matches |
150016 |
Non-Matches |
qqww |
Author |
Rating:
Roman Lukyanenko
|
Title |
Test
Details
Pattern Title
|
Expression |
^((?:\+27|27)|0)(=72|82|73|83|74|84)(\d{7})$ |
Description |
Verifies South African mobile numbers with or without the country code. |
Matches |
+27832762842 | 27832762842 | 0832762842 |
Non-Matches |
083 276 2842 |
Author |
Rating:
Mpho Molahloe
|
Title |
Test
Details
Pattern Title
|
Expression |
^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,},\x20[A-Za-z]{2}\x20\d{5}(-\d{4})?$ |
Description |
This is a simple expression to check a US street address entered on either one or two lines. Being short it does not check that the road qualifer is "valid" (eg. drive, avenue, etc), but it does allow for the extended zip code. A word of warning, the multiline mode can be picky about ending the first line with extra space. |
Matches |
123 Anywhere Dr. apt #99 Somewhere, ST 55789 | 123 Anywhere Dr. Somewhere, ST 55789 | 123 Anywhere D |
Non-Matches |
123 Anywhere Drive #99 Somewhere, ST 55789 - 1234 | 123 Anywhere Dr. apt. #99 Somewhere, ST 55789 | |
Author |
Rating:
Gideon Engelberth
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?<national>\+?(?:86)?)(?<separator>\s?-?)(?<phone>(?<vender>13[0-4])(?<area>\d{4})(?<id>\d{4}))$ |
Description |
Just test in C#.
Validates a China Unicom mobile phone number with (or without) the International code.
|
Matches |
+8613012345678 | 86 13012345678 | 13245679087 |
Non-Matches |
+86130123456781231434352 | 13560012513 | ++8613012345678 |
Author |
Rating:
Evan Tao
|
Title |
Test
Details
Pattern Title
|
Expression |
^(([A-Z]{1,2}[0-9]{1,2})|([A-Z]{1,2}[0-9][A-Z]))\s?([0-9][A-Z]{2})$ |
Description |
Matches UK postcodes of the below formats. The space is optional.
AN NAA
AAN NAA
ANN NAA
ANA NAA
AANA NAA
AANN NAA
|
Matches |
A11AA | AA1A 1AA | AA11 1AA |
Non-Matches |
AAA 1AA | AA11A 1AA | AAA1AA |
Author |
Rating:
Phil A
|
Title |
Test
Details
Pattern Title
|
Expression |
^[\(]? ([^0-1]){1}([0-9]){2}([-,\),/,\.])*([ ])?([^0-1]){1}([0-9]){2}[ ]?[-]?[/]?[\.]? ([0-9]){4}$ |
Description |
Here is a regular expression I wrote that validates U.S. phone numbers with area codes. You can't have a leading '0' or '1' but you can separate the number blocks with a space, a dot, a slash, or a hyphen. It also prevents a '0' or '1' for the first digit of the prefix. No extension is allowed and it must be 10 digits. |
Matches |
(713) 555-1212 | 713/555/1212 | 713.555 1212 |
Non-Matches |
07135551212 | 7130125551212 |
Author |
Rating:
Bruce Hatherly
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?:(?:[\+]?(?<CountryCode>[\d]{1,3}(?:[ ]+|[\-.])))?[(]?(?<AreaCode>[\d]{3})[\-/)]?(?:[ ]+)?)?(?<Number>[a-zA-Z2-9][a-zA-Z0-9 \-.]{6,})(?:(?:[ ]+|[xX]|(i:ext[\.]?)){1,2}(?<Ext>[\d]{1,5}))?$ |
Description |
This allows the formatting of most phone numbers. |
Matches |
1-800-DISCOVER | (610) 310-5555 x5555 | 533-1123 |
Non-Matches |
1 533-1123 | 553334 | 66/12343 |
Author |
Rating:
Nicholas Berardi
|
Title |
Test
Details
Pattern Title
|
Expression |
^\d{5}((-|\s)?\d{4})?$ |
Description |
Single field zip code validator, useful for Web Forms. Allows user to enter 5-digit or 5-digit plus 4 zip code, with hyphen or space or NO space between last 4 digits. |
Matches |
92078-4705 | 920784705 | 92078 4705 |
Non-Matches |
9027x | 902 | 92078.4705 |
Author |
Rating:
MARK J KRISBURG
|
Title |
Test
Details
Pattern Title
|
Expression |
\b((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))\b |
Description |
This is my attempt to find out valid german postal codes (PLZ or Postleitzahlen).
After the German Unification the numbers were changed to a five digit system. The postal codes starts with the two digit "Leitzahl". This is a number between 00 and 99 excluding the not yet used numbers: 00, 05, 43 and 62! After that follows directly a three digit number, 000-999.
Comments welcome. This works for me, however I think it could be written more compact, but could not figure out how ;-)
For more information on german postal codes see:
http://de.wikipedia.org/wiki/Liste_der_Postleitbereiche_Deutschland
http://de.wikipedia.org/wiki/Postleitzahl_%28Deutschland%29
http://en.wikipedia.org/wiki/List_of_postal_codes_in_Germany |
Matches |
12556 | 01550 | 80796 |
Non-Matches |
05234 | 8973 | 62980 |
Author |
Rating:
Markus Matern
|
Title |
Test
Details
Phone Numbers
|
Expression |
^(1\s*[-\/\.]?)?(\((\d{3})\)|(\d{3}))\s*[-\/\.]?\s*(\d{3})\s*[-\/\.]?\s*(\d{4})\s*(([xX]|[eE][xX][tT])\.?\s*(\d+))*$ |
Description |
This regular expressions matches phone numbers with area codes and optional US country code and optional phone extension. User have so many ways of entering phone numbers into input fields. This allows for some of the ones I've encountered. Feel free to contact me if you find ones that do not match. |
Matches |
2405525009 | 1(240) 652-5009 | 240/752-5009 ext.55 |
Non-Matches |
(2405525009 | 2 (240) 652-5009 |
Author |
Rating:
Dean Dal Bozzo
|
Title |
Test
Details
Pattern Title
|
Expression |
^(\d{5}-\d{4}|\d{5})$|^([a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d)$ |
Description |
This is a modification of the zip code regular expression submitted by Steven Smith ( [email protected])
It no longer matches 78754-12aA |
Matches |
78754 | 78754-1234 | G3H 6A3 |
Non-Matches |
78754-12aA | 7875A | g3h6a3 |
Author |
Rating:
Khoi Pham
|
Title |
Test
Details
Pattern Title
|
Expression |
\d{1,3}.?\d{0,3}\s[a-zA-Z]{2,30}\s[a-zA-Z]{2,15} |
Description |
Street Address. While far from perfect it validates street addresses reasonably. Created with absolutely no experience using a cool tool downloaded from http://www.codeproject.com/dotnet/expresso.asp?target=e%20xpresso |
Matches |
2\34 Wodonga Ave | 54a Beechworth Rd | 47/675 WODONGA DRIVE |
Non-Matches |
aaa Beechworth Rd | 65 Beechworth Rd | 65 Beechworth/ Rd |
Author |
Rating:
adam willding
|
Title |
Test
Details
Pattern Title
|
Expression |
^[1-9][0-9]{3}\s?[a-zA-Z]{2}$ |
Description |
Validates Dutch Postal Codes (ZipCode). There was a previous one listed here, but it's not entirely correct. Namely that dutch postal codes can contain a zero but cannot start with one, so this one is the adjusted version. |
Matches |
1234AB | 1234 AB | 1001 AB |
Non-Matches |
0123AB | 1234A B | 0123 AB |
Author |
Rating:
Jos Krause
|
Title |
Test
Details
U.S. Street Address
|
Expression |
^(?n:(?<address1>(\d{1,5}(\ 1\/[234])?(\x20[A-Z]([a-z])+)+ )|(P\.O\.\ Box\ \d{1,5}))\s{1,2}(?i:(?<address2>(((APT|B LDG|DEPT|FL|HNGR|LOT|PIER|RM|S(LIP|PC|T(E|OP))|TRLR|UNIT)\x20\w{1,5})|(BSMT|FRNT|LBBY|LOWR|OFC|PH|REAR|SIDE|UPPR)\.?)\s{1,2})?)(?<city>[A-Z]([a-z])+(\.?)(\x20[A-Z]([a-z])+){0,2})\, \x20(?<state>A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADL N]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD] |T[NX]|UT|V[AIT]|W[AIVY])\x20(?<zipcode>(?!0{5})\d{5}(-\d {4})?))$ |
Description |
captures US street address.
Address format: ##### Street 2ndunit City, ST zip+4
address1 - must have street number and proper case street name. no punctuation or P.O Box #### punctuation manditory for P.O.
address2 - optional secondary unit abbr. Secondary range required for some units.
City - Proper case city name.
State - State abbreviation. All caps
zip - zip+4. Can't be all zeroes
Abbreviations for secondary units and States are those used by the US Postal Service.
http://www.usps.com/ncsc/lookups/usps_abbreviations.html
Certain secondary units require a secondary range, see the above link
THis RE isn't unbreakable, Probably will allow some false positives but should work for most addresses. |
Matches |
123 Park Ave Apt 123 New York City, NY 10002 | P.O. Box 12345 Los Angeles, CA 12304 |
Non-Matches |
123 Main St | 123 City, State 00000 | 123 street city, ST 00000 |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
State Codes
|
Expression |
^(?-i:A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$ |
Description |
The RE match U.S. state abbreviation used by the U.S. Post Office. |
Matches |
AL | CA | AA |
Non-Matches |
New York | California | ny |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?:(?<1>[(])?(?<AreaCode>[2-9]\d{2})(?(1)[)])(?(1)(?<2>[ ])|(?:(?<3>[-])|(?<4>[ ])))?)?(?<Prefix>[1-9]\d{2})(?(AreaCode)(?:(?(1)(?(2)[- ]|[-]?))|(?(3)[-])|(?(4)[- ]))|[- ]?)(?<Suffix>\d{4})(?:[ ]?[xX]?(?<Ext>\d{2,4}))?$ |
Description |
Regular expression for validating US telephone numbers with OPTIONAL area code, and OPTIONAL extension. Matches various permutations of formatting characters (parenthesis, space, dash). Parses the telephone number area code, prefix, suffix, and extension to named groups to facilitate program manipulation. Area code is optional and can optionally be enclosed in parentheses. Rejects area codes that begin with 0 or 1 and prefixes that begin with 0. Extension is optional and can be optionally preceded by a space and/or "x" or "X", and matches on 2 to 4 digits. Rejects all telephone numbers that do not match on exactly 7 digits, or on exactly 10 digits with the optional area code, not counting the extension or the formatting characters. |
Matches |
333-4444 | (222) 333-4444 | 222-333-4444 X55 |
Non-Matches |
222333 4444 | (222)-333 4444 | 333-4444-5555 |
Author |
Rating:
Jerry Schmersahl
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?:(?<1>[(])?(?<AreaCode>[2-9]\d{2})(?(1)[)])(?(1)(?<2>[ ])|(?:(?<3>[-])|(?<4>[ ])))?)?(?<Prefix>[1-9]\d{2})(?(AreaCode)(?:(?(1)(?(2)[- ]|[-]?))|(?(3)[-])|(?(4)[- ]))|[- ]?)(?<Suffix>\d{4})$ |
Description |
Regular expression for validating US telephone numbers with OPTIONAL area code. Matches various permutations of formatting characters (parenthesis, space, dash). Parses the telephone number area code, prefix, and suffix to named groups to facilitate program manipulation. Area code is optional and can optionally be enclosed in parentheses. Rejects area codes that begin with 0 or 1 and prefixes that begin with 0. Rejects all telephone numbers that do not match on exactly 7 digits, or on exactly 10 digits with the optional area code, not counting the formatting characters. |
Matches |
333-4444 | 222 333 4444 | (222) 333-4444 |
Non-Matches |
222333 4444 | 222-333 4444 | (222)-333 4444 |
Author |
Rating:
Jerry Schmersahl
|
Title |
Test
Details
Pattern Title
|
Expression |
^[a-zA-Z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ\.\,\-\/\']+[a-zA-Z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ\.\,\-\/\' ]+$ |
Description |
This simple regexp should match any possible italian address entry and doesn't match NULL entries (good if address is required). Should work well for any other address (it's been verified against 250 addresses from most european countries, usa and australia. Please mail me if there's something missing |
Matches |
v.le dell'industria 45/a | via genova 45-3-d | p.zza Garibaldi, 48 |
Non-Matches |
[NULL] |
Author |
Rating:
paolo beltrami
|
Title |
Test
Details
Pattern Title
|
Expression |
^((AL)|(AK)|(AS)|(AZ)|(AR)|(CA)|(CO)|(CT)|(DE)|(DC)|(FM)|(FL)|(GA)|(GU)|(HI)|(ID)|(IL)|(IN)|(IA)|(KS)|(KY)|(LA)|(ME)|(MH)|(MD)|(MA)|(MI)|(MN)|(MS)|(MO)|(MT)|(NE)|(NV)|(NH)|(NJ)|(NM)|(NY)|(NC)|(ND)|(MP)|(OH)|(OK)|(OR)|(PW)|(PA)|(PR)|(RI)|(SC)|(SD)|(TN)|(TX)|(UT)|(VT)|(VI)|(VA)|(WA)|(WV)|(WI)|(WY))$ |
Description |
This validates the states and territories of the United States in a 2 character uppercase format. Very poor excuse for a regular expression! ;)
Written by Jason Gaylord. |
Matches |
NY | PA | NJ |
Non-Matches |
Pennsylvania | Pa | pa |
Author |
Rating:
Jason N. Gaylord
|
Title |
Test
Details
Pattern Title
|
Expression |
(\s*\(?0\d{4}\)?(\s*|-)\d{3}(\s*|-)\d{3}\s*)|(\s*\(?0\d{3}\)?(\s*|-)\d{3}(\s*|-)\d{4}\s*)|(\s*(7|8)(\d{7}|\d{3}(\-|\s{1})\d{4})\s*) |
Description |
another uk telephone number regex. This was adapted from another on this site http://www.regexlib.com/REDetails.aspx?regexp_id=297
I added support for hyphens and for london shorthand numbers ie. 8234-1234 72341234 Still want to be permissive where possible....Still need to sort out the all zeros, also not sure if numbers with 4 digits followed by 7 used in london 0208-234-1234 is the area of the uk where this occurs, or all areas outside of london are in format 5 digits followed by 6 digits ie. 01608 123456. If that is the case for the 4-7 pattern only 0208 or 0207 could be enforced. |
Matches |
0208 993 5689 | 0208-993-5689 | 89935689 |
Non-Matches |
1608 123 456 |
Author |
Rating:
Matt Baskey
|
Displaying page
of
pages;
Items to