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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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
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-2025, RegexAdvice.com | ASP.NET Tutorials