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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Simple US Phone Numbers
Expression
(1)?-?\(?\s*([0-9]{3})\s*\)?\s*-?([0-9]{3})\s*-?\s*([0-9]{4})\s*
Description
A very simple regex to parse 10-digit US phone numbers. Captures the leading 1 in $1, the area code in $2, the 3-digit prefix in $3, and the four-digit postfix in $4. This expression DOES allow for reserved area codes (001,etc) which are not typically in use.
Matches
(123)456-7890 | 1234567890 | 123 456 7890 | 123-456-7890 | (123)4567890 | 123-4567890
Non-Matches
123456789 | (1234)567890 | (12-3)4567890
Author Rating: The rating for this expression. Jeff Chambers
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