18 May, 2012

Regular Expression for US Phone Number

>>  Criteria


Validates a U.S. phone number. It must consist of 3 numeric characters,
optionally enclosed in parentheses, followed by a set of 3 numeric characters and
then a set of 4 numeric characters.


>>  For Example


(425) 555-0123
425-555-0123
425 555 0123
1-425-555-0123

>>  Regular Expression

"^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$"

Refence:
http://msdn.microsoft.com/en-us/library/ff650303.aspx