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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details 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
   Displaying page 1 of 1 pages; Items 1 to 1

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