Displaying page
of
pages;
Items to
Title |
Test
Details
Simple US Phone Numbers
|
Expression |
(1)?-?\(?\s*([0-9]{3})\s*\)?\s*-?([0-9]{3})\s*-?\s*([0-9]{4})\s*
|
Description |
A very simple regex to parse 10-digit US phone numbers. Captures the leading 1 in $1, the area code in $2, the 3-digit prefix in $3, and the four-digit postfix in $4.
This expression DOES allow for reserved area codes (001,etc) which are not typically in use.
|
Matches |
(123)456-7890 | 1234567890 | 123 456 7890 | 123-456-7890 | (123)4567890 | 123-4567890
|
Non-Matches |
123456789 | (1234)567890 | (12-3)4567890
|
Author |
Rating:
Jeff Chambers
|
Displaying page
of
pages;
Items to