I am trying to build a javascript regex for phone number.
I currently have this...but it is failing.
^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})?[#. ]?([0-9]{10})$
Examples:
(555) 555-1212 - Acceptable
(555) 555-1212 #12525 - Acceptable (Up to 10 digits after the # sign)
5555551212 - Acceptable
555-555-1212 - Acceptable
555-555-1212 #12525 - Acceptable (Up to 10 digits after the # sign)
Any alpha characters should be Unacceptable
(555) 555-1212 ext 12525 - Unacceptable
(555) 555-1212 x12525 - Unacceptable
Regex has been a weak area of mine and I am not sure how to make it work.