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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$
Description
Matches US phone number format. 1 in the beginning is optional, area code is required, spaces or dashes can be used as optional divider between number groups. Also alphanumeric format is allowed after area code.
Matches
1-(123)-123-1234 | 123 123 1234 | 1-800-ALPHNUM
Non-Matches
1.123.123.1234 | (123)-1234-123 | 123-1234
Author Rating: The rating for this expression. Igor Kravtsov
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

Title: Add support for numbers starting with + sign
Name: Muhammad Zubair
Date: 9/18/2019 2:19:01 PM
Comment:
It does not support + in start of number. E.g. +11231231234


Title: Improvements for brevity
Name: Anonymous Regexer
Date: 7/2/2017 12:23:48 AM
Comment:
Replace every "[0-9]" with "\d" for a more compact and readable regular expression. Also, instead of using "( |-)", use "[ -]", that's what the square brackets are meant for. Instead of "[a-zA-Z0-9]", use "[^_\w]"


Title: test
Name: test1
Date: 6/4/2016 10:51:17 PM
Comment:
<TABLE width="838" background="example_files/world.png" border="0"› <TBODY> <TR> <TD width="196">&nbsp; </TD> <TD width="461"> <H3 style="color: rgb(204, 204, 204); font-size: 12px; font-weight: bold;">Largest metropolitan areas by continent</H3> <UL style="color: rgb(204, 204, 204); font-size: 12px; font-weight: normal "> <LI>Asia <OL> <LI>Shanghai, China (31.23°N, 121.47°E): 15M inhab.</LI> <LI>Bombay, India (18.96°N, 72.82°E): 12.9M inhab.</LI> <LI>Karachi, Pakistan (24.86°N, 67.01°E): 12M inhab.</LI> <LI>Delhi, India (28.67°N, 77.21°E): 11.2M inhab.</LI> <LI>Manila, Philippines (14.62°N, 120.97°E): 10.5M inhab.</LI> <LI>Seoul, South Korea (37.56°N, 126.99°E): 10.4M inhab.</LI> <LI>Jakarta, Indonesia (6.18°S, 106.83°E): 8.6M inhab.</LI> <LI>Tokyo, Japan (35.67°N, 139.77°E): 8.4M inhab.</LI></OL></LI> <LI>South America <OL> <LI>Buenos Aires, Argentina (34.61°S, 58.37°W): 11.6M inhab.</LI> <LI>sao Paulo, Brazil (23.53°S, 46.63°W): 10M inhab.</LI> <LI>Mexico City, Mexico (19.43°N, 99.14°W): 8.7M inhab.</LI></OL></LI> <LI>Europe <OL> <LI>Moscow, Russia (55.75°N, 37.62°E): 10.5M inhab.</LI> <LI>Istanbul, Turkey (41.10°N, 29.00°E): 10M inhab.</LI></OL></LI> <LI>Africa <OL> <LI>Lagos, Nigeria (6.45°N, 3.47°E): 9M inhab.</LI></OL></LI> <LI>North America <OL> <LI>New York, United States (40.67°N, 73.94°W): 8.1M inhab.</LI></OL></LI></UL></TD> <TD width="167">&nbsp; </TD></TR> <TR> <TD height="57">&nbsp;</TD> <TD>&nbsp;</TD> <TD>&nbsp;</TD></TR></TBODY></TABLE></DIV></Div>


Title: Validate period as a seperator.
Name: M Styers
Date: 2/21/2013 12:02:07 PM
Comment:
Add a . to ( |-) to validate periods as separators. Ex. ( |-|.)


Title: 99x99-999x9
Name: SURAJ
Date: 2/22/2011 11:25:18 AM
Comment:
find the rejex


Title: 99x99-999x9
Name: SURAJ
Date: 2/22/2011 10:29:39 AM
Comment:
find the rejex


Title: 99x99-999x9
Name: SURAJ
Date: 2/22/2011 10:28:30 AM
Comment:
find the rejex


Title: 99x99-999x9
Name: SURAJ
Date: 2/22/2011 10:27:57 AM
Comment:
find the rejex


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