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

Please support RegExLib Sponsors

Sponsors

Browse Expressions by Category

104 regular expressions found in this category!

Expressions in category: Address/Phone

Change page:   |    Displaying page 1 of 6 pages; Items 1 to 20
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: The rating for this expression. Chris Weidert
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
^(?:\([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
^([\(]{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
^(\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: The rating for this expression. Khoi Pham
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: The rating for this expression. Bill Hely
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-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}( |-)?\d{4}|^\d{3}( |-)?\d{3}( |-)?\d{4}
Description
Expresion Regular para Teléfonos con clave lada en México separada o no con guiones o espacios. Sirve para teléfonos estacionarios y/o celulares, con o sin paréntesis, 10 nú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
^[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: The rating for this expression. Santosh Potadar
Title Test Details Pattern Title
Expression
(((^[BEGLMNS][1-9]\d?) | (^W[2-9] ) | ( ^( A[BL] | B[ABDHLNRST] | C[ABFHMORTVW] | D[ADEGHLNTY] | E[HNX] | F[KY] | G[LUY] | H[ADGPRSUX] | I[GMPV] | JE | K[ATWY] | L[ADELNSU] | M[EKL] | N[EGNPRW] | O[LX] | P[AEHLOR] | R[GHM] | S[AEGKL-PRSTWY] | T[ADFNQRSW] | UB | W[ADFNRSV] | YO | ZE ) \d\d?) | (^W1[A-HJKSTUW0-9]) | (( (^WC[1-2]) | (^EC[1-4]) | (^SW1) ) [ABEHMNPRVWXY] ) ) (\s*)? ([0-9][ABD-HJLNP-UW-Z]{2})) | (^GIR\s?0AA)
Description
Here it is, the monster UK Postcode regular expression that should prevent the majority of miskeying. Unlike an most other regexes it only permits valid combinations of letters, e.g. BN works, BM does not. Spaces between the first and second parts are optional. I have tested this against a file of 7,500 valid postcodes, and also against a real-world list of about 12,000 which had some bad data. Manually checking a sample of the rejected ones showed it was working correctly (and how poor the data was!!). I originally started by trying to adapt the GDSC document at http://www.govtalk.gov.uk/gdsc/html/frames/PostCode.htm and specifically their XSD pattern at http://www.govtalk.gov.uk/gdsc/schemaHtml/bs7666-v2-0-xsd-PostCodeType.htm but this turned out to be rather loose. Instead I wrote this. If you find any valid postcodes being rejected by this regex please let me know.
Matches
W1A 1AA | EC2V 1JN | GIR 0AA
Non-Matches
TB12 1AB | EC2V 1JM | W2A 1AA
Author Rating: The rating for this expression. Howard Richards
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: The rating for this expression. Jeff Gabriel
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: The rating for this expression. Dennis de Jong
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: The rating for this expression. M h
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: The rating for this expression. Matthew Aznoe
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: The rating for this expression. Gideon Engelberth
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: The rating for this expression. Markus Matern
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
^(?:(?:[\+]?(?<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
^[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: The rating for this expression. Jos Krause
Change page:   |    Displaying page 1 of 6 pages; Items 1 to 20

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