Regular expression for a phone number

Posted by Zerobu on Stack Overflow See other posts from Stack Overflow or by Zerobu
Published on 2010-03-21T03:32:24Z Indexed on 2010/03/21 3:41 UTC
Read the original article Hit count: 369

Filed under:
|
|

Hello, I would like a regular expression in this format. It Must match one of the following formats:

* (###)###-####
* ###-###-####
* ###.###.####
* ##########

Strip all whitespace. Make sure it's a valid phone number, then (if necessary) translate it to the first format listed above.

© Stack Overflow or respective owner

Related posts about perl

Related posts about regex