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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^(\(\d{3}\)[- ]?|\d{3}[- ])?\d{3}[- ]\d{4}$
Description
US telephone pattern. Optional area code with or without '()'. If area code has parentheses then it is optionally followed by - or space. If no parentheses then it must be followed by - or space. Number must be separated by either a space or -.
Matches
(555)555-5555 | (555) 555-5555 | 555-5555
Non-Matches
5555555555 | 555.555.5555 | (555 555-5555
Author Rating: Not yet rated. Charles Eatley
Source I am sure this has been done many times before.
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

Title: Thanks
Name: Dianne
Date: 4/3/2005 1:13:50 PM
Comment:
You save me a great deal of time, exactly what I needed, formatted as most phone numbers are. Thanks


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