- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find Phone Numbers
This regular expressions matches phone numbers with area codes and optional US country code and optional phone extension. User have so many ways of entering phone numbers into input fields. This allows for some of the ones I've encountered. Feel free to contact me if you find ones that do not match.
2405525009 | 1(240) 652-5009 | 240/752-5009 ext.55
(2405525009 | 2 (240) 652-5009
Author Rating: The rating for this expression. Dean Dal Bozzo
Your Rating
Bad Good

Enter New 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: Very good
Name: Jax
Date: 3/24/2015 7:26:33 AM
Thanks for the great regex, built on it a little but works great! just a heads up for future development it does not recognise the follow: - Spaces between digits (some people break up into common formats such as 01784 1...) - hyphen between the numbers (Netherlands). Otherwise great 5 stars from me!

Title: Regex for Fax
Name: Pankaj
Date: 5/17/2011 6:48:47 AM
hello i want a regular expression for fax which accepts numerics,space,"-","()","+".Can u plz provide it

Title: Slightly improved
Name: Kevin
Date: 1/12/2010 11:36:41 AM
I added the +1 option, fixed a bug with the hyphen between the 1 and the area code, and made the extensions more flexible. ^(1\s*[-\/\.]?\s*)?(\((\d{3})\)|(\d{3}))\s*[-\/\.]?\s*(\d{3})\s*[-\/\.]?\s*(\d{4})\s*(([xX]|[eE][xX][tT]?)\.?\s*([#*\d]+))*$

Title: only digits???
Name: Bodia Soryformyenglish:)
Date: 11/28/2009 12:44:44 PM
Please add to Matches number "one-one-one";)

Title: optional area codes
Name: Mtimdog
Date: 3/10/2004 2:21:57 PM
Does not accept numbers without area code like 333-4444.... Fixed by adding (....stuff for 1(333) areacode....)? to it

Title: '+1'
Name: Harley
Date: 11/11/2003 9:15:22 PM
Does not accept numbers with a + in front of the 1 (as is customary for international codes), such as: +1 987 654 3210 Easily fixed with the addition of a \+? just before the 1. Thanks for a great RE!

Copyright © 2001-2018, | ASP.NET Tutorials