I am trying to verify a mobile phone number in the USA since I am using the built-in JavaScript validation library that I just replaced this regex validation with the previous version that comes with the validation library.
previous validation regular expression:
"telephone":{ "regex":"/^[0-9\-\(\)\ ]{10,10}$/", "alertText":"* Invalid phone number"},
This works like 2126661234 , but not in the US standard.
After I changed:
"telephone":{ "regex":"/^[2-9]\d{2}-\d{3}-\d{4}$/", "alertText":"* Invalid phone number"},
Now every entry gets an error, even if I enter 212-666-1234 . I really don't know what happened, so I'm waiting for some help.
source share