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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find US Phone Number[ANY format]
Expression
^\D{0,2}[0]{0,3}[1]{0,1}\D{0,2}([2-9])(\d{2})\D{0,2}(\d{3})\D{0,2}(\d{3})\D{0,2}(\d{1})\D{0,2}$
Description
Very useful if you want to use ANY-NON-DIGIT as delimiter and return proper US-Phone-Number. Use "($1) $2-$3$4" to get Number in form: "(234) 567-8901". Will ignore starting 1, 01, 001, +1 etc. Validates and also captures AreaCode, Prefix and Suffix for reformatting. In all matching examples, it will return the same result. I have not found any exception yet.
Matches
(234) 567-8901 | +1-234-567-890-1 | +001 2345678901 | +1/234/567/890-1 | 0012345678901 | X234X567X890X1X | (+001)(234)(5678901) | +1(234)5678901 | +1 234 567 890-1 | [234][567][890(1)] | 234/567/890/1 | 12345678901
Non-Matches
12X345678901 | 23456789X01 | 5678901
Author Rating: Not yet rated. Waqas Mehmood
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

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