I searched for phone number validation and ended up with below javascript code
jQuery.validator.addMethod(\"phoneUS\", function(phone_number, element) {
ph
I think this question is already asked with answer as well. Check this A comprehensive regex for phone number validation
You can add an optional match at the end of the regex
( x\d{4})?
Which will match x followed by digits, that is eg x1234
if it is present
( x\d{4})?
the quantifier ?
matches zero or one occurence of ( x\d{4})
The regex can be
^\(?(\d{3})\)?[-\. ]?(\d{3})[-\. ]?(\d{4})( x\d{4})?$
For example : http://regex101.com/r/sG9qJ6/1