I found this code in some website, and it works perfectly. It validates that the phone number is in one of these formats: (123) 456-7890 or 123-
Try this js function. Returns true if it matches and false if it fails Ref
function ValidatePhoneNumber(phone) { return /^\+?([0-9]{2})\)?[-. ]?([0-9]{4})[-. ]?([0-9]{4})$/.test(phone); }