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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Pattern Title
Expression
^(?:(?<Contry>\d{1,1})(?<5>[- ]?)?)?(?:(?<1>[(])?(?<AreaCode>[2-9]\d{2})(?(1)[)])(?(1)(?<2>[ ])|(?:(?<3>[-])|(?<4>[ ])))?)?(?<Prefix>[1-9]\d{2})(?(AreaCode)(?:(?(1)(?(2)[- ]|[-]?))|(?(3)[-])|(?(4)[- ]))|[- ]?)(?<Suffix>\d{4})(?:[ ]?[#xXeE]?(?<Ext>\d{2,4}))?$
Description
Regular expression for validating US and CANADA telephone numbers with OPTIONAL contry code, OPTIONAL area code, and OPTIONAL extension. Matches various permutations of formatting characters (parenthesis, space, dash). Parses the telephone number contry code, area code, prefix, suffix, and extension ...
Matches
1-(222) 333-4444 | 1 (222) 333-4444 | 12223334444
Non-Matches
1- (222) 333 4444 | 1 (222) 333-4444 | 1 2223334444
Author Rating: The rating for this expression. Marc Robitaille
   Displaying page 1 of 1 pages; Items 1 to 1

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