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 Regular Expression for Phone Numbers in the US
Expression
/^(1)?(-|.)?(\()?([0-9]{3})(\))?(-|.)?([0-9]{3})(-|.)?([0-9]{4})/
Description
I was looking for a regex that allows pretty much any combo of a US phone number. I found some that covered most of the bases, but not all of them. This regex allows for missing characters, periods, hyphens. It should cover most of the bases. If not, let me know! I want to make it better!
Matches
1231231234 | 11231231234 | 1-1231231234 | 1123-1231234 | 1123123-1234 | 1-123-1231234 | 1-123123-1234 | 1123-123-1234 | 1-123-123-1234 | (1231231234 | 123)1231234 | (123)1231234 | (123)-1231234 | (123)123-1234 | (123)-123-1234 | (123-1231234 | (123123-1234 | 123)-1231234 | 123)123-1234 | (123-123-1234 | 123)-123-1234 | 1(123)1231234 | 1(1231231234 | 1123)1231234 | 1-(1231231234 | 1-123)1231234 | 1-(123)1231234 | 1-(123-1231234 | 1-(123123-1234 | 1-123)-1231234 | 1-123)123-1234 | 1-(123)-1231234 | 1-(123)123-1234 | 1-(123)-123-1234 | -1231231234 | -123-1231234 | -123123-1234 | -123-123-1234 | -
Non-Matches
)123(1231234 | 123-1233-123 | (123(1231234
Author Rating: The rating for this expression. sebastian frohm
   Displaying page 1 of 1 pages; Items 1 to 1

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