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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find U,S. Phone Number Parser for .NET (with named groups)
Expression
(\+1|1)?[ \-\.]?\(?(?<areacode>[0-9]{3})\)?[ \-\.]?(?<prefix>[0-9]{3})[ \-\.]?(?<number>[0-9]{4})[ \.]*(ext|x)?[ \.]*(?<extension>[0-9]{0,5})
Description
This regular expression parses virtually any variety of U.S. phone numbers--with or without an extension. If you want a version without the named groups, you can use: (\+1|1)?[ \-\.]?\(?[0-9]{3}\)?[ \-\.]?[0-9]{3}[ \-\.]?[0-9]{4}[ \.]*(ext|x)?[ \.]*[0-9]{0,5}
Matches
601-555-1212|601 5551212|+1.6015551212|601 555 1212|601.555.1212x232|601.555.1212ext232|1 601.555.1212ext232|+1 601.555.1212ext232|+1.(601)5551212|(601) 555 1212|601.555.1212x232|601.555.1212 x233|601.555.1212 x 234|601.555.1212 ext 234|601.555.1212 ext. 234
Non-Matches
601+555+1212
Author Rating: Not yet rated. Anthony Gatlin
Source Anthony Gatlin
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