A comprehensive regex for phone number validation
Posted
by Nicholas Trandem
on Stack Overflow
See other posts from Stack Overflow
or by Nicholas Trandem
Published on 2008-09-23T20:13:42Z
Indexed on
2010/06/01
0:13 UTC
Read the original article
Hit count: 164
I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following:
- 1-234-567-8901
- 1-234-567-8901 x1234
- 1-234-567-8901 ext1234
- 1 (234) 567-8901
- 1.234.567.8901
- 1/234/567/8901
- 12345678901
I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant.
© Stack Overflow or respective owner