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

Please support RegExLib Sponsors

Sponsors

Advanced Search

Keywords

Category

Minimum Rating

Results per Page

Search Results: 104 regular expressions found.

Change page:   |    Displaying page 1 of 2 pages; Items 1 to 100
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: Not yet rated. 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
^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$
Description
Matches US phone number format. 1 in the beginning is optional, area code is required, spaces or dashes can be used as optional divider between number groups. Also alphanumeric format is allowed after area code.
Matches
1-(123)-123-1234 | 123 123 1234 | 1-800-ALPHNUM
Non-Matches
1.123.123.1234 | (123)-1234-123 | 123-1234
Author Rating: The rating for this expression. Igor Kravtsov
Title Test Details Pattern Title
Expression
((\(\d{3}\)?)|(\d{3}))([\s-./]?)(\d{3})([\s-./]?)(\d{4})
Description
US Phone number that accept a dot, a space, a dash, a forward slash, between the numbers. Will Accept a 1 or 0 in front. Area Code not necessary
Matches
1.2123644567 | 0-234.567/8912 | 1-(212)-123 4567
Non-Matches
0-212364345 | 1212-364,4321 | 0212\345/6789
Author Rating: Not yet rated. Mart Maasikas
Title Test Details Pattern Title
Expression
[0-9]{4}\s*[a-zA-Z]{2}
Description
Dutch zip code expression 4 numbers - space yes/no - 2 letters
Matches
1054 WD | 1054WD | 1054 wd
Non-Matches
10543
Author Rating: Not yet rated. Roland Mensenkamp
Title Test Details Pattern Title
Expression
(^1300\d{6}$)|(^1800|1900|1902\d{6}$)|(^0[2|3|7|8]{1}[0-9]{8}$)|(^13\d{4}$)|(^04\d{2,3}\d{6}$)
Description
Australian phone numbers: Matches all known formats incl normal 10-digit landline numbers (valid area code mandatory) 13, 1300, 1800, 1900, 1902 plus mobile 10 and 11-digit formats. Use a Replace function first to remove non-numerics which are probably separators (E.g. newNum = number.replace(/[\D]/g, ""). Please contact me if you find any valid Aussie numbers being rejected.
Matches
0732105432 | 1300333444 | 131313
Non-Matches
32105432 | 13000456
Author Rating: Not yet rated. Bill Hely
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 (ssmith@aspalliance.com) It no longer matches 78754-12aA
Matches
78754 | 78754-1234 | G3H 6A3
Non-Matches
78754-12aA | 7875A | g3h6a3
Author Rating: Not yet rated. Khoi Pham
Title Test Details Pattern Title
Expression
^[A-Za-z]{1,2}[0-9A-Za-z]{1,2}[ ]?[0-9]{0,1}[A-Za-z]{2}$
Description
This regular expression can be used to validate UK postcodes. Especially useful if want to provide a client side validation on a web site.
Matches
SW112LE | SW11 2LE | CR05LE
Non-Matches
12CR0LE | 12CR 0LE | SWLE05
Author Rating: Not yet rated. Santosh Potadar
Title Test Details Pattern Title
Expression
^(1?(-?\d{3})-?)?(\d{3})(-?\d{4})$
Description
US Telephone Reg expression that allows 7, 10 or 11 digits with or without hyphens.
Matches
15615552323 | 1-561-555-1212 | 5613333
Non-Matches
1-555-5555 | 15553333 | 0-561-555-1212
Author Rating: Not yet rated. jay gann
Title Test Details Pattern Title
Expression
^[\\(]{0,1}([0-9]){3}[\\)]{0,1}[ ]?([^0-1]){1}([0-9]){2}[ ]?[-]?[ ]?([0-9]){4}[ ]*((x){0,1}([0-9]){1,5}){0,1}$
Description
US Telephone Number where this is regular expression excludes the first number, after the area code,from being 0 or 1; it also allows an extension to be added where it does not have to be prefixed by 'x'.
Matches
(910)456-7890 | (910)456-8970 x12 | (910)456-8970 1211
Non-Matches
(910) 156-7890 | (910) 056-7890 | (910) 556-7890 x
Author Rating: The rating for this expression. Bill Anderson
Title Test Details Pattern Title
Expression
^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\s\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 | T2P 3C7
Non-Matches
44240ddd | t44240-55 | t2p3c7
Author Rating: The rating for this expression. Qing Jiang
Title Test Details Pattern Title
Expression
^0(6[045679][0469]){1}(\-)?(1)?[^0\D]{1}\d{6}$
Description
Validates Austrian Cellular Phone Numbers. Works with ONE, T-Mobile, A1, Telering and new Provider "Drei". WITHOUT Country Code Verification.
Matches
0664-1234567 | 06641234567 | 0699-11234567
Non-Matches
06991-1234567 | +43650-1234567 | 07661234567
Author Rating: Not yet rated. Stefan Beylen
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: Not yet rated. Jos Krause
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: Not yet rated. 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: Not yet rated. Jason N. Gaylord
Title Test Details Pattern Title
Expression
^([\(]{1}[0-9]{3}[\)]{1}[ ]{1}[0-9]{3}[\-]{1}[0-9]{4})$
Description
It is the exact phone number regular expression for '(###) ###-####'. Written by Jason Gaylord.
Matches
(555) 555-1212
Non-Matches
555-1212 | 1-800-555-1212 | 555-555-1212
Author Rating: The rating for this expression. Jason N. Gaylord
Title Test Details Pattern Title
Expression
^[1-9]{1}[0-9]{3}\s{0,1}?[a-zA-Z]{2}$
Description
Used for dutch postalcodes; no leading zero. 4 numbers and 2 letters.
Matches
1234AB | 1234 AB | 1234 ab
Non-Matches
0123AB | 123AA
Author Rating: Not yet rated. Michiel Lankamp
Title Test Details Pattern Title
Expression
^([\(]{1}[0-9]{3}[\)]{1}[\.| |\-]{0,1}|^[0-9]{3}[\.|\-| ]?)?[0-9]{3}(\.|\-| )?[0-9]{4}$
Description
More permissive than others on the site, this one allows you to let a user enter US phone numbers in the way they most commonly use, without letting them enter non-valid combinations.
Matches
5551212 | 614555-1212 | (614)555-1212
Non-Matches
A12-5555 | (614-555-1212 | 555*1212
Author Rating: Not yet rated. Jeff Gabriel
Title Test Details Pattern Title
Expression
^((\d{5}-\d{4})|(\d{5})|([AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtVvXxYy]\d[A-Za-z]\s?\d[A-Za-z]\d))$
Description
Regular expression for US (ZIP and ZIP+4) and Canadian postal codes. It allows 5 digits for the first US postal code and requires that the +4, if it exists, is four digits long. Canadain postal codes can contain a space and take form of A1A 1A1. The letters can be upper or lower case, but the first letter must be one of the standard Canadian zones: A,B,C,E,G,H,J,K,L,M,N,P,R,S,T,V,X,Y.
Matches
00501 | 84118-3423 | n3a 3B7
Non-Matches
501-342 | 123324 | Q4B 5C5
Author Rating: Not yet rated. Matthew Aznoe
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: Not yet rated. adam willding
Title Test Details Pattern Title
Expression
^([0-9]*\-?\ ?\/?[0-9]*)$
Description
Match italian telephone number with prefix followed by "/", "-" or blank and number. Usefull with numeric keybord!
Matches
02-343536 | 02/343536 | 02 343536
Non-Matches
02a343536 | 02+343536
Author Rating: Not yet rated. Giorgio Spugnesi
Title Test Details Pattern Title
Expression
(\d{4,6})
Description
Simple Postcode - this is the first test of the new WebService :-)
Matches
4078 | 539999
Non-Matches
dfasdf | afasdfsad
Author Rating: Not yet rated. Darren Neimke
Title Test Details Pattern Title
Expression
^[0-9]{5}([\s-]{1}[0-9]{4})?$
Description
My first Expression. This will match US postal codes (zip codes) using simple 5 digit format with optional 4 digit extention seperated by a space or hyphen. Will not accept letters. example: 12345 or 12345-1234 or 12345 1234.
Matches
12345-1234 | 12345 | 12345 1234
Non-Matches
123451234 | 12345 a345 | a2345-1234
Author Rating: Not yet rated. Ed Stafford
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: The rating for this expression. Dean Dal Bozzo
Title Test Details Pattern Title
Expression
^[0-9]{5}([- /]?[0-9]{4})?$
Description
US Zip Code + 4 digit extension Postal Code
Matches
14467 | 144679554 | 14467-9554
Non-Matches
14467 955 | 14467- | 1446-9554
Author Rating: Not yet rated. Chris Weidert
Title Test Details Pattern Title
Expression
^p(ost)?[ |\.]*o(ffice)?[ |\.]*(box)?[ 0-9]*[^[a-z ]]*
Description
This expression is useful for determining if an address is a PO Box type address. This can be useful in shipping systems as well as other systems that need to make determinations based on the type of address imputed.
Matches
po box 4353
Non-Matches
pollo St. | P. O. Box d3f12s | BOX 23
Author Rating: Not yet rated. Darryl Kuhn
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: The rating for this expression. Michael Ash
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: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
^(\(?\d\d\d\)?)?( |-|\.)?\d\d\d( |-|\.)?\d{4,4}(( |-|\.)?[ext\.]+ ?\d+)?$
Description
Basic US phone number matching pattern. I found this place and used a regex, so figured I'd share.
Matches
(888) 555-1212 | 888.555.1212 | (888) 555.1212 ext. 1212
Non-Matches
(800) got-fish | 011+ 78907 2344323
Author Rating: Not yet rated. Jon Stephens
Title Test Details Pattern Title
Expression
(^\d{5}$)|(^\d{5}-\d{4}$)
Description
I know its probaly in the library, but i did not see it. US zip pattern 5 digits 01234 or 5 digits + 4 01234-1234
Matches
12345 | 12345-6789 | 01234
Non-Matches
1A234 | 12345-aaaa | 12345 1234
Author Rating: Not yet rated. Jay Solomon
Title Test Details Pattern Title
Expression
(?<Telephone>([0-9]|[ ]|[-]|[\(]|[\)]|ext.|[,])+)([ ]|[:]|\t|[-])*(?<Where>Home|Office|Work|Away|Fax|FAX|Phone)|(?<Where>Home|Office|Work|Away|Fax|FAX|Phone|Daytime|Evening)([ ]|[:]|\t|[-])*(?<Telephone>([0-9]|[ ]|[-]|[\(]|[\)]|ext.|[,])+)|(?<Telephone>([(]([0-9]){3}[)]([ ])?([0-9]){3}([ ]|-)([0-9]){4}))
Description
Its extracts telephone numbers
Matches
(913) 451-6461
Non-Matches
3523d3adb3
Author Rating: Not yet rated. Manpreet Grewal
Title Test Details Pattern Title
Expression
([\(]?(?<AreaCode>[0-9]{3})[\)]?)?[ \.\-]?(?<Exchange>[0-9]{3})[ \.\-](?<Number>[0-9]{4})
Description
This was used to process a bunch of lines of information to determine if a line was a North American phone number or not. It accepts numbers with or without area code with or without parenthesis and sepearated by space, dash or period.
Matches
(602) 555-3696 | 555-2069 | 213.555.8954
Non-Matches
225-582 | 11000
Author Rating: Not yet rated. Jared Tullis
Title Test Details Pattern Title
Expression
^\s*\(?(020[7,8]{1}\)?[ ]?[1-9]{1}[0-9{2}[ ]?[0-9]{4})|(0[1-8]{1}[0-9]{3}\)?[ ]?[1-9]{1}[0-9]{2}[ ]?[0-9]{3})\s*$
Description
Matches UK phone numbers - London and regional. It started off with something fairly short posted by liljim at www.forums.devshed.com but I wanted a little more precision to weed out all the zeros. Now it also weeds out premium phone numbers (as of 19/12/03).
Matches
02071111111 | 01000100000
Non-Matches
00000000000
Author Rating: Not yet rated. M h
Title Test Details Pattern Title
Expression
^[D-d][K-k]-[1-9]{1}[0-9]{3}$
Description
Postalcode Danmark
Matches
Dk-1234 | dk-1234 | DK-1234
Non-Matches
DK 1234 | DK 12345
Author Rating: Not yet rated. paul Snabilie
Title Test Details Pattern Title
Expression
^[D-d][K-k]( |-)[1-9]{1}[0-9]{3}$
Description
match all danish postal code update from last danish postal code expression
Matches
DK-1234 | dk 1234 | Dk-1234
Non-Matches
DK 12345
Author Rating: Not yet rated. paul Snabilie
Title Test Details Pattern Title
Expression
^[S-s]( |-)?[1-9]{1}[0-9]{2}( |-)?[0-9]{2}$
Description
Swedish postcodes (as far as i know)
Matches
S-123 45 | s 123 45 | S123-45
Non-Matches
Se12345
Author Rating: Not yet rated. paul Snabilie
Title Test Details Pattern Title
Expression
^[a-zA-Z\d]+(([\'\,\.\- #][a-zA-Z\d ])?[a-zA-Z\d]*[\.]*)*$
Description
Address It has now been enhanced to accept # too!!
Matches
393 12th St. City, State Zip code
Non-Matches
12 street @@@
Author Rating: Not yet rated. Sadaf Ahmed
Title Test Details Pattern Title
Expression
^[abceghjklmnprstvxyABCEGHJKLMNPRSTVXY][0-9][abceghjklmnprstvwxyzABCEGHJKLMNPRSTVWXYZ] {0,1}[0-9][abceghjklmnprstvwxyzABCEGHJKLMNPRSTVWXYZ][0-9]$
Description
Canadian Postal Code / Codes / Canada / Zip Google for DFIOQU and you'll see where I got the info for this. Can anyone simplify this?
Matches
G3M 5T9 | C3M5T9
Non-Matches
Z3M 5T9 | W3M 5T9 | 5T9 C3M
Author Rating: Not yet rated. W. D.
Title Test Details Pattern Title
Expression
^([\+][0-9]{1,3}[\.][0-9]{1,12})([x]?[0-9]{1,4}?)$
Description
Validates on the following standards: +CCC.ZZZZZZZZZZxYYYY, where 'C' is the numeric country phone code (up to three digits), 'Z' is the phone number (up to 12 digits) and 'Y' is the extension (up to 4 digits); max length overall is 20 characters, including the '+', '.', and 'x' (if extension is present). Useful for people communicating with the OpenSRS API
Matches
+800.4453377x4444 | +80.4453377 | +8.123456789123x1111
Non-Matches
181823884499 | +800.4453377x | 2486994x11
Author Rating: Not yet rated. Hayk A
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: Not yet rated. 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})(?:[ ]?[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 &quot;x&quot; or &quot;X&quot;, 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: Not yet rated. Jerry Schmersahl
Title Test Details Pattern Title
Expression
^[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}(\-| |){1}[0-9]{1}[a-zA-Z]{1}[0-9]{1}$
Description
This expression will help match Quebec's postal codes.
Matches
h2j-3c4 | H2J 3C4 | H2J-3c4
Non-Matches
H2J_3C4 | H213C4 | 123456
Author Rating: Not yet rated. Frederic Trudeau
Title Test Details Pattern Title
Expression
^[A-Za-z]{1,2}[\d]{1,2}([A-Za-z])?\s?[\d][A-Za-z]{2}$
Description
UK Postal Codes - The code is normally written in capital letters with a space between the outer and inner parts; it is understandable if the space is omitted. This regular expression validates upper or lower case with or without the space:
Matches
CF1 2AA | cf564fg
Non-Matches
a1234d | A12 77Y
Author Rating: Not yet rated. Scott Pite
Title Test Details Pattern Title
Expression
^[+][0-9]\d{2}-\d{3}-\d{4}$
Description
This is a basic telephone number vaildation which needs a compulsory prefix of a '+' sign with three digits and followed by a hipen, another three digits and finally followed by another hipen and four more digits. Regards, Senthil Gunabalan
Matches
+974-584-5656 | +000-000-0000 | +323-343-3453
Non-Matches
974-584-5656 | +974 000 0000
Author Rating: Not yet rated. Senthil Gunabalan
Title Test Details Pattern Title
Expression
^([+]39)?((38[{8,9}|0])|(34[{7-9}|0])|(36[6|8|0])|(33[{3-9}|0])|(32[{8,9}]))([\d]{7})$
Description
Validates a Italian mobile phone number with (or without) the International code
Matches
+393471234567 | 3381234567
Non-Matches
+39 3401234567 | 347 1234567 | 338-1234567
Author Rating: The rating for this expression. Fabrizio Fortini
Title Test Details Pattern Title
Expression
^[01]?[- .]?\(?[2-9]\d{2}\)?[- .]?\d{3}[- .]?\d{4}$
Description
U. S. or Canadian telephone number regular expression. &lt;BR&gt; &lt;BR&gt; // # Checks phone numbers for validity &lt;BR&gt; // [01]? # optional '0', or '1' &lt;BR&gt; // [- .]? # optional separator is either a dash, a space, or a period. &lt;BR&gt; // \(? # optional parentheses &lt;BR&gt; // [2-9] # first # of the area code must not be a '0' or '1' &lt;BR&gt; // \d{2} # next 2 digits of area code can be 0-9 &lt;BR&gt; // \)? # optional parentheses &lt;BR&gt; // [- .]? # optional separator is either a dash, a space, or a period. &lt;BR&gt; // \d{3} # 3-digit prefix &lt;BR&gt; // [- .]? # optional separator is either a dash, a space, or a period. &lt;BR&gt; // \d{4} # 4-digit station number &lt;BR&gt;
Matches
18008793262 | 800-879-3262 | 0-800.879.3262
Non-Matches
879 3262 | 077 879 3262 | 879-3262
Author Rating: Not yet rated. W. D.
Title Test Details UK Phone Number
Expression
^((\(?0\d{4}\)?\s?\d{3}\s?\d{3})|(\(?0\d{3}\)?\s?\d{3}\s?\d{4})|(\(?0\d{2}\)?\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$
Description
UK phone number. Allows 3, 4 or 5 digit regional prefix, with 8, 7 or 6 digit phone number respectively, plus optional 3 or 4 digit extension number prefixed with a # symbol. Also allows optional brackets surrounding the regional prefix and optional spaces between appropriate groups of numbers.
Matches
01222 555 555 | (010) 55555555 #2222 | 0122 555 5555#222
Non-Matches
01222 555 5555 | (010) 55555555 #22 | 0122 5555 5555#222
Author Rating: Not yet rated. Amos Hurd
Title Test Details UK Mobile Phone Number
Expression
^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$
Description
UK mobile phone number, with optional +44 national code. Allows optional brackets and spaces at appropriate positions.
Matches
07222 555555 | (07222) 555555 | +44 7222 555 555
Non-Matches
7222 555555 | +44 07222 555555 | (+447222) 555555
Author Rating: Not yet rated. Amos Hurd
Title Test Details Modified UK Phone Number
Expression
^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$
Description
Modified version of UK phone number regular expression. Now allows +44 national code in addition to extension numbers of 3 or 4 digits. Previous expression was: ^((\(?0\d{4}\)?\s?\d{3}\s?\d{3})|(\(?0\d{3}\)?\s?\d{3}\s?\d{4})|(\(?0\d{2}\)?\s?\d{4}\s?\d{4}))(\s?#(\d{4}|\d{3}))?$
Matches
+447222555555 | +44 7222 555 555 | (0722) 5555555 #2222
Non-Matches
(+447222)555555 | +44(7222)555555 | (0722) 5555555 #22
Author Rating: Not yet rated. Amos Hurd
Title Test Details Pattern Title
Expression
^([2-9])(\d{2})(-?|\040?)(\d{4})( ?|\040?)(\d{1,4}?|\040?)$
Description
A regular expression that validates the any format of fixed telephone numbers inside Lima - Peru, including an optional extension of at least one number up to four numbers.
Matches
263-8854 | 5660578 1235 | 622-4588 21
Non-Matches
1227585 | 4224586 50124 | 0554499
Author Rating: Not yet rated. Alan Ferrandiz Langley
Title Test Details Pattern Title
Expression
^([8-9])([1-9])(\d{2})(-?|\040?)(\d{4})$
Description
A regular expression that validates the any of the new formats of cellular phones numbers in Peru, allows an optional dash in the middle of the number.
Matches
8874-2544 | 99106800 | 84509955
Non-Matches
6540-9985 | 77329390 | 725-2763
Author Rating: Not yet rated. Alan Ferrandiz Langley
Title Test Details Pattern Title
Expression
^(?!\d[1]{2}|[5]{3})([2-9]\d{2})([. -]*)\d{4}$
Description
Validates *usable* US telephone numbers (possibly Canadian and Caribbean Islands as well?) Numbers cannot beginning with zero, one, (any number)11, or 555. It will allow either a hyphen, space or period as a separator. Technically (and contrary to popular belief) most 555- numbers ARE valid numbers [see http://www.nanpa.com/nas/public/form555MasterReport.do?method=display555MasterReport ] but they are unlikely to be used by normal folks. Therefore, excluding them with this regex is useful to prevent bogus/fraudulent telephone numbers in forms. FYI, the fictitious 555- numbers used in the movies and TV are only in the range of 555-0100 through 555-0199. Not very many, huh?
Matches
222-2222 | 295-5000
Non-Matches
555-1234 | 411-5555 | 099-9999
Author Rating: Not yet rated. JP Honeywell
Title Test Details Pattern Title
Expression
^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}$
Description
US Phone Number: This regular expression for US phone numbers conforms to NANP A-digit and D-digit requirments (ANN-DNN-NNNN). Area Codes 001-199 are not permitted; Central Office Codes 001-199 are not permitted. Format validation accepts 10-digits without delimiters, optional parens on area code, and optional spaces or dashes between area code, central office code and station code. Acceptable formats include 2225551212, 222 555 1212, 222-555-1212, (222) 555 1212, (222) 555-1212, etc. You can add/remove formatting options to meet your needs.
Matches
5305551212 | (530) 555-1212 | 530-555-1212
Non-Matches
0010011212 | 1991991212 | 123) not-good
Author Rating: The rating for this expression. Don Johnston
Title Test Details Pattern Title
Expression
\d{5}\-\d{3}
Description
Brazilian Postal Box RegExp validation
Matches
02245-999
Non-Matches
ABCDE-FGH
Author Rating: Not yet rated. Valmir Cinquini
Title Test Details Pattern Title
Expression
^(?:(?&lt;1&gt;[(])?(?&lt;AreaCode&gt;[2-9]\d{2})(?(1)[)][ ]?|[- \/.]?))? (?&lt;Prefix&gt;[1-9]\d{2})[- .]?(?&lt;Suffix&gt;\d{4}) (?:(?:[ ]+|[xX]|Ext\.?[ ]?){1,2}(?&lt;Ext&gt;\d{1,5}))?$
Description
PCRE (PHP) regular expression for validating US telephone numbers with OPTIONAL area code, and OPTIONAL extension. Promiscuous formatting (parenthesis or slash, space, dash, dot or no separator). Captures the telephone number area code, prefix, suffix, and extension to named groups. 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 extension or the format. Seperators, when used, must be in the right place. Extension can be preceded by a space(s) and/or &quot;x&quot;, &quot;X&quot;, or &quot;Ext&quot; and matches on 1 to 5 digits. Written from the view that getting phone numbers from customers should be as easy and tolerant as possible. Matched number can be parsed and entered into database correctly on the business end. Based on similar regex by Jerry Schmersahl in this library. Case insensitivity could simplify this expression, but implementation is left up to you. For PHP/PCRE compatibility, put a &quot;P&quot; in front of each capture name (ie: &quot;(?P&lt;AreaCode&gt;&quot;). This server does not recognize the Python/PCRE naming convention.
Matches
785/3215564x51337 | (785)321-5564 Ext. 51337 | 321.5564 x5
Non-Matches
785321556 | (785)321-5564 x | 7853 215567
Author Rating: Not yet rated. Bret Greenwood
Title Test Details Pattern Title
Expression
^(\()?(787|939)(\)|-)?([0-9]{3})(-)?([0-9]{4}|[0-9]{4})$
Description
Filter US telephone numbers. This particular one accepts only area code 939 or 787. Area code parentesis or hyphens optional.
Matches
(787)755-0114 | 939-315-0112 | 7879093849
Non-Matches
(098)737-3942 | (89)893-2392 | 939782721
Author Rating: Not yet rated. Ricardo Gonzalez
Title Test Details Pattern Title
Expression
(\+)?([-\._\(\) ]?[\d]{3,20}[-\._\(\) ]?){2,10}
Description
Telephone number filter - use to catch and replace phone numbers where you don't want them to appear.
Matches
(604) 789-0136 | +123-45678-908
Non-Matches
01.12.23
Author Rating: Not yet rated. Dave Turner
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: The rating for this expression. Roman Lukyanenko
Title Test Details Pattern Title
Expression
^[0-9]{2,3}-? ?[0-9]{6,7}$
Description
Validates Spain Phones
Matches
972367087 | 97-3770866 | 972-377086
Non-Matches
9988-989898 | 989898988989 | 9 9898989898
Author Rating: Not yet rated. Francesc Vila
Title Test Details Pattern Title
Expression
^(\+97[\s]{0,1}[\-]{0,1}[\s]{0,1}1|0)50[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$
Description
regex which matches UAE mobile phone numbers. Its capable to take inputs +97150 3827741, +97-150-3827741, +97150 - 3827741,050 3827741, 050 - 3827741 Enjoy REGEXXXXXXX!!!!!!!
Matches
+97150 3827741 | 0503827741 | 050-3827741
Non-Matches
040 3827741 | 05 3827741 | 050_______spaces_______3827741
Author Rating: The rating for this expression. Vathachira Joseph Bino
Title Test Details Pattern Title
Expression
^0[234679]{1}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$
Description
The regex matches the UAE land phone numbers. Checks the area codes[04,02,06...etc] strictly. Force user to input phone numbers in strict manner(it take input 04 3452488, but not 04______spaces_______3452488)
Matches
04 3452488 | 04 -3452488 | 04 - 3452499
Non-Matches
01 -3452488 | 04 34524888 | 08 3452488
Author Rating: The rating for this expression. Vathachira Joseph Bino
Title Test Details Pattern Title
Expression
^0{0,1}[1-9]{1}[0-9]{2}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$
Description
The regex that matches the telephone numbers in India. ####Enjoy Regex####
Matches
0493 - 3227341 | 0493 3227341 | 493 3227341
Non-Matches
93 0227341 | 493 322734111 | 493 -- 3227341
Author Rating: Not yet rated. Vathachira Joseph Bino
Title Test Details Pattern Title
Expression
^((\+){0,1}91(\s){0,1}(\-){0,1}(\s){0,1}){0,1}98(\s){0,1}(\-){0,1}(\s){0,1}[1-9]{1}[0-9]{7}$
Description
The Regex validate the mobile numbers in India. Gives flexibility to user to enter numbers in different format like +919847444225, +91-98-45017381, 9844111116, 98 44111112, 98-44111116 ###Enjoy REGEX###
Matches
+919847444225 | +91-98-44111112 | 98 44111116
Non-Matches
+919800444225 | +947444225 | 44111116
Author Rating: Not yet rated. Vathachira Joseph Bino
Title Test Details Pattern Title
Expression
((\(\d{3,4}\)|\d{3,4}-)\d{4,9}(-\d{1,5}|\d{0}))|(\d{4,12})
Description
telphone number check.
Matches
0833-1234567-8888 | (0833)1234567-8888 | 12345678
Non-Matches
ceocio | !@$@#$
Author Rating: The rating for this expression. Liu Wei
Title Test Details Pattern Title
Expression
((\(\d{3}\) ?)|(\d{3}[- \.]))?\d{3}[- \.]\d{4}(\s(x\d+)?){0,1}$
Description
This will match US most common telephones format with extension or with out extension. Works with both Java and .NET.
Matches
(123) 456-7890 | (123) 456-7890 x123
Non-Matches
(123) 456-7890 x123x | (123) 456-7890 x123 x123 | (123) 456-7890 x
Author Rating: Not yet rated. khoi le
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: The rating for this expression. Matt Baskey
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: Not yet rated. Matt Baskey
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: The rating for this expression. Nicholas Berardi
Title Test Details Pattern Title
Expression
^(?:\([2-9]\d{2}\)\ ?|(?:[2-9]\d{2}\-))[2-9]\d{2}\-\d{4}$
Description
This US phone number edit with restricted format options: Accepts optional parens on area code with or without following space, and dashes between area code, central office code and station code. Formats include only (222) 555-1212 (with or without a space) and 222-555-1212. Conforms to NANP A-digit and D-digit requirements (ANN-DNN-NNNN). Area Codes 001-199 are not permitted; Central Office Codes 001-199 are not permitted.
Matches
(234) 555-1212 | (234)555-1212 | 234-555-1212
Non-Matches
(234)5551212 | 234 555 1212 | 234) 555-1212
Author Rating: Not yet rated. Don Johnston
Title Test Details Pattern Title
Expression
^[0-9]{5}$
Description
Matches german standard postal codes named 'Postleitzahl'
Matches
03242 | 36260 | 12394
Non-Matches
3520 | 102 | 100202
Author Rating: Not yet rated. Kevin Wennemuth
Title Test Details Pattern Title
Expression
^((([A-PR-UWYZ])([0-9][0-9A-HJKS-UW]?))|(([A-PR-UWYZ][A-HK-Y])([0-9][0-9ABEHMNPRV-Y]?))\s{0,2}(([0-9])([ABD-HJLNP-UW-Z])([ABD-HJLNP-UW-Z])))|(((GI)(R))\s{0,2}((0)(A)(A)))$
Description
Validates UK postcodes and aligns in parenthesized subpatterns according to standard UK postcode elements. Validation is according to guidelines outlined at http://www.govtalk.gov.uk/gdsc/html/noframes/PostCode-2-1-Release.htm Postcode elements are separated according to description at http://www.graticule.com/data/uk/pcdata.html Expression is not thoroughly tested, but seems to be doing ok so far! Comments and improvements welcome.
Matches
GIR 0AA | SW1Y 1AA | AB1 4BL
Non-Matches
XVJ P09 | GB7Z 1HQ | Q1 1AA
Author Rating: Not yet rated. Christopher Townson
Title Test Details Pattern Title
Expression
^[1-9]{1}[0-9]{3}\s?[A-Z]{2}$
Description
Postcode for the Netherlands
Matches
1234AB | 1234 AB
Non-Matches
123BBB | 023AB
Author Rating: Not yet rated. de kleine Gerardus
Title Test Details Pattern Title
Expression
^(\d{3}-\d{3}-\d{4})*$
Description
This expression is a very simplex expression that allows null values or 3 digits, dash, 3 digits, dash, 4 digits. It validates a basic US phone number. Written by Jason N. Gaylord.
Matches
555-555-1212 | 123-456-7890
Non-Matches
555.555.1212 | (555) 555-1212 | 5555551212
Author Rating: Not yet rated. Jason N. Gaylord
Title Test Details Pattern Title
Expression
^(\d{2}-\d{2})*$
Description
This expression is a simplex expression that checks to see if a value is a valid phone system terminal number. It allows a null value or 2 digits, dash, 2 digits. Written by Jason N. Gaylord.
Matches
00-00 | 54-68
Non-Matches
1235 | 0 | 5-789
Author Rating: Not yet rated. Jason N. Gaylord
Title Test Details Pattern Title
Expression
(^(p[\s|\.|,]*| ^post[\s|\.]*)(o[\s|\.|,]*| office[\s|\.]*))| (^box[.|\s]*\d+)
Description
This expression filters all variations of Post Office Box or PO Box.
Matches
PO Box | p.o. box | box 123
Non-Matches
123 Some Street
Author Rating: Not yet rated. Joseph Lamb
Title Test Details Pattern Title
Expression
[0-9]{4}[A-Z]{2}
Description
Match for dutch zipcodes. Dutch zipcodes are always in the format of 4 digits and 2 letters.
Matches
1000AB | 3035KA | 9999ZZ
Non-Matches
AA1000 | Z1000 | 1000-CC
Author Rating: Not yet rated. marrik
Title Test Details Pattern Title
Expression
^([0-9]{2})?((\([0-9]{2})\)|[0-9]{2})?([0-9]{3}|[0-9]{4})(\-)?[0-9]{4}$
Description
A simple expression to brazilian phone number code modified expression of Rafael, beyond international code, simple DDI without &quot;+&quot; 99 plus simple DDD (99) plus simple and whitout parentheses em trace, local phone number 3 or 4 digits plus &quot;-&quot; plus 4 digits.
Matches
552123236699 | 212323-6699 | 2323-6699
Non-Matches
[3434-3432] | [4(23)232-3232] | [55(2)232-232]
Author Rating: Not yet rated. wallace dos santos damiao
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: The rating for this expression. Bruce Hatherly
Title Test Details Pattern Title
Expression
^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$
Description
This is a pretty flexable phone number validator for US numbers. Allows optional country code and area code. Allows separation of numbers with &quot; &quot;, &quot;-&quot;, &quot;.&quot; or nothing to seperate. Area codes can be in parenthesis or not. Validates that you'll get 7, 10, or 11 digits in the way the most number of people option when writing them.
Matches
1(555)444-3333 | 202.555.3333 | 555-4444
Non-Matches
555-222-33334 | 1(303)5a4-5555 | 1 202) 111-3333
Author Rating: Not yet rated. Josh Aversa
Title Test Details Pattern Title
Expression
^\([0-9]{3}\)\s?[0-9]{3}(-|\s)?[0-9]{4}$|^[0-9]{3}-?[0-9]{3}-?[0-9]{4}$
Description
US telephone check
Matches
1231231234 | (123)123-1234 | 123-123-1234
Non-Matches
12312312345 | (123)-123-1234 | 123
Author Rating: Not yet rated. PJ Bijoy
Title Test Details Pattern Title
Expression
(^(?!0{5})(\d{5})(?!-?0{4})(-?\d{4})?$)
Description
Javascript matches US zipcodes not allowing all zeros in first 5 or +4
Matches
12345 | 12345-6789 | 123456789
Non-Matches
12345-0000 | 00000-0000 | 00000
Author Rating: Not yet rated. Justin Elsberry
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: The rating for this expression. MARK J KRISBURG
Title Test Details Pattern Title
Expression
^\d{5}((\-|\s)?\d{4})?$
Description
Single field zip code validator useful for web forms, where user may enter 5 digit or 9 digit zip code, and may use hyphen, space, or no space between the first 5 digits and last 4 digits.
Matches
92078 | 92078-4705 | 92078 4705
Non-Matches
920781 | 920a87 | 920
Author Rating: Not yet rated. MARK J KRISBURG
Title Test Details Pattern Title
Expression
^(\([2-9]|[2-9])(\d{2}|\d{2}\))(-|.|\s)?\d{3}(-|.|\s)?\d{4}$
Description
Telephone validator allowing user to enter 10 digit telephone number with segments of number separated by hyphens, periods or spaces. Also braces allowed around area code.
Matches
213-123-1234 | 2131231234 | (213) 123-1234
Non-Matches
123-123-1234
Author Rating: The rating for this expression. MARK J KRISBURG
Title Test Details Pattern Title
Expression
^\(?(?<AreaCode>[2-9]\d{2})(\)?)(-|.|\s)?(?<Prefix>[1-9]\d{2})(-|.|\s)?(?<Suffix>\d{4})$
Description
US telephone number with area code. Validates and also captures AreaCode, Prefix and Suffix for reformatting.
Matches
(213) 343-1234 | 213-343-1234 | 213 343 1234
Non-Matches
343-1234
Author Rating: Not yet rated. MARK J KRISBURG
Title Test Details Validate US Postal Code
Expression
^(?!00000)(?<zip>(?<zip5>\d{5})(?:[ -](?=\d))?(?<zip4>\d{4})?)$
Description
Validate US zip codes. Matches all zip codes of exactly 5 digits except 00000. Optionally, matches zip5+zip4 where zip5 is exactly 5 digits, zip4 is exactly 4 digits, and zip5 and zip4 are, optionally, separated by a single space or hyphen. Captures zip5 and zip4 to named groups to facilitate program manipulation.
Matches
12345 | 123456789 | 12345-6789
Non-Matches
12345- | 00000 | 00000-6789
Author Rating: Not yet rated. Jerry Schmersahl
Title Test Details Pattern Title
Expression
(?<zip5>^\d{5})([\- ]?(?<plus4>\d{4})?$)
Description
Zip Code (Zip or Zip-Plus4 format). Accepts a hyphen, a space, or nothing between Zip and Plus4 segments. Named segments &lt;zip&gt; and &lt;plus4&gt; may be used to reformat users input to desired format using Regex replace function (re.replace).
Matches
92078 | 92078-4705 | 92078-4705
Non-Matches
9207 | 92078470 | 92078*4705
Author Rating: Not yet rated. MARK J KRISBURG
Title Test Details Pattern Title
Expression
([0]{1}[6]{1}[-\s]*[1-9]{1}[\s]*([0-9]{1}[\s]*){7})|([0]{1}[1-9]{1}[0-9]{1}[0-9]{1}[-\s]*[1-9]{1}[\s]*([0-9]{1}[\s]*){5})|([0]{1}[1-9]{1}[0-9]{1}[-\s]*[1-9]{1}[\s]*([0-9]{1}[\s]*){6})
Description
Meets dutch phone number requirements.. One posted here before didn't allow the 0 after the first digit of the call ID (so the second number or later after the prefix), which should be allowed. I modified that one to meet full requirements now.. Enjoy!!
Matches
06 12345678 | 010-1234560 | 0111-101234
Non-Matches
05-43021212 | 123-4567890 | 1234567890
Author Rating: Not yet rated. Dennis de Jong
Title Test Details Pattern Title
Expression
^(9,)*([1-9]\d{2}-?)*[1-9]\d{2}-?\d{4}$
Description
Validates US or Canadian phone numbers with the use of &quot;-&quot; or numbers stuck together. No parantheses allowed as well as spaces. Area code is optional. The &quot;9,&quot; is optional as well, which on some phone systems is needed to dial out.
Matches
9,5143393044 | 9,514-339-3044 | 339-3044
Non-Matches
9,339 3044 | 514 440 2009 | (514) 440-2009
Author Rating: Not yet rated. Max Cacchiotti
Title Test Details Pattern Title
Expression
^([0-9]{5})([\-]{1}[0-9]{4})?$
Description
Validates against a U.S. postal code in either a 5 digit format or a 5 dash 4 format.
Matches
18017 | 18017-1401
Non-Matches
1801A | 18017- | 18017-152A
Author Rating: Not yet rated. Jeff Johns
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: The rating for this expression. Mpho Molahloe
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: The rating for this expression. Phil A
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: The rating for this expression. Evan Tao
Title Test Details Pattern Title
Expression
(^0.*[1-9]*)|(^860+)|(^8613)|(\D)|([0-9])
Description
forbidden tele numbers when it starts with 0, 860+,8613,character or has any SBC case. you can also use it to any international phone dialed by E1 ,etc . this regex has been tested by java, perl,.net PS: the last regex [0-9]is in SBC case
Matches
0234568 | 8601063971622 | 1-221555
Non-Matches
861063971622
Author Rating: Not yet rated. qi gao
Title Test Details Pattern Title
Expression
^\(\d{3}\) ?\d{3}( |-)?\d{4}|^\d{3}( |-)?\d{3}( |-)?\d{4}
Description
Expresion Regular para Tel&#233;fonos con clave lada en M&#233;xico separada o no con guiones o espacios. Sirve para tel&#233;fonos estacionarios y/o celulares, con o sin par&#233;ntesis, 10 n&#250;meros a fuerzas, funciona en .net
Matches
(658)154-1122 | 6581541122 | 658-154-1122
Non-Matches
(658 154 1122 | 759-1245 | 875 (489 1568)
Author Rating: The rating for this expression. Alex Cons
Title Test Details Pattern Title
Expression
(02\d\s?\d{4}\s?\d{4})|(01\d{2}\s?\d{3}\s?\d{4})|(01\d{3}\s?\d{5,6})|(01\d{4}\s?\d{4,5})
Description
Validates UK domestic landline phone numbers. Valid formats are: 029 99999999 or 029 9999 9999; 0199 9999999 or 0199 999 9999; 01999 99999; 01999 999999; 019999 9999; 019999 99999. These formats are taken from the official guidelines from Ofcom, the organisation responsible for UK telecoms issues. Brackets are not valid and STD code must be entered.
Matches
020 1234 5678 | 0123 4567890 | 01234 456789
Non-Matches
02476 123456 | 0845 123456 | 07712 345678
Author Rating: The rating for this expression. John Chivers
Title Test Details Pattern Title
Expression
(077|078|079)\s?\d{2}\s?\d{6}
Description
Validates UK mobile phone numbers. Valid formats are `077', `078' or `079' followed by another 8 digits, with an optional space after the dialling code and/or between the 4th and 5th characters of the remainder of the number. These formats are taken from the official guidelines from Ofcom, the organisation responsible for UK telecoms issues. Brackets are not valid and STD code must be entered.
Matches
07713 345678 | 078 12345678 | 079 12345678
Non-Matches
02344 123456 | 0121 292929 | 012345 6789
Author Rating: Not yet rated. John Chivers
Title Test Details Pattern Title
Expression
^\s*((?:(?:\d+(?:\x20+\w+\.?)+(?:(?:\x20+STREET|ST|DRIVE|DR|AVENUE|AVE|ROAD|RD|LOOP|COURT|CT|CIRCLE|LANE|LN|BOULEVARD|BLVD)\.?)?)|(?:(?:P\.\x20?O\.|P\x20?O)\x20*Box\x20+\d+)|(?:General\x20+Delivery)|(?:C[\\\/]O\x20+(?:\w+\x20*)+))\,?\x20*(?:(?:(?:APT|BLDG|DEPT|FL|HNGR|LOT|PIER|RM|S(?:LIP|PC|T(?:E|OP))|TRLR|UNIT|\x23)\.?\x20*(?:[a-zA-Z0-9\-]+))|(?:BSMT|FRNT|LBBY|LOWR|OFC|PH|REAR|SIDE|UPPR))?)\,?\s+((?:(?:\d+(?:\x20+\w+\.?)+(?:(?:\x20+STREET|ST|DRIVE|DR|AVENUE|AVE|ROAD|RD|LOOP|COURT|CT|CIRCLE|LANE|LN|BOULEVARD|BLVD)\.?)?)|(?:(?:P\.\x20?O\.|P\x20?O)\x20*Box\x20+\d+)|(?:General\x20+Delivery)|(?:C[\\\/]O\x20+(?:\w+\x20*)+))\,?\x20*(?:(?:(?:APT|BLDG|DEPT|FL|HNGR|LOT|PIER|RM|S(?:LIP|PC|T(?:E|OP))|TRLR|UNIT|\x23)\.?\x20*(?:[a-zA-Z0-9\-]+))|(?:BSMT|FRNT|LBBY|LOWR|OFC|PH|REAR|SIDE|UPPR))?)?\,?\s+((?:[A-Za-z]+\x20*)+)\,\s+(A[LKSZRAP]|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])\s+(\d+(?:-\d+)?)\s*$
Description
Based on a regular expression from Michael Ash, this captures US street addresses and mailing addresses, single or multi-line (multi-line is more reliable), and breaks them into discrete parts for address line 1 and 2, city, state, and postal code. This expression is not perfect - with the interpreter I am using, some addresses refuse to match correctly. It should however work for most addresses, particularly when lines are delimited with carriage returns, tabs, or some other whitespace line delimiter that is not a space (\x20). Note: For improved compatibility, this expression does not use named groups. **Output** \1 = Address 1, \2 = Address 2, \3 = City, \4 = State, \5 = Postal Code
Matches
P.O. Box 42 Huslia, AK 99746 | C/O John Paul, POBox 456, Motown, CA 96090
Non-Matches
4321 East 40th Apt #3 Anchorage AK 99504 | Stockton, CA 95215
Author Rating: Not yet rated. Ross Hammer
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 &quot;valid&quot; (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: Not yet rated. Gideon Engelberth
Title Test Details Pattern Title
Expression
(^\([0]\d{2}\))(\d{6,7}$)
Description
Validator for New Zealand Mobile phone numbers. Will look for the first number being a 0 and must be a number or either 6 or 7 digits long after to initial (021) suffix
Matches
(021)1234567 | (021)123456 | (000)000000
Non-Matches
(123)1234567 | 025123456 | 0252345678
Author Rating: Not yet rated. Graeme Allwood
Change page:   |    Displaying page 1 of 2 pages; Items 1 to 100

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