example of a regular expression in jquery for phone numbers
Use this rexeg
/\(?([0-9]{3})\)?([ .-]?)([0-9]{3})\2([0-9]{4})/
- (123) 456 7899
- (123).456.7899
- (123)-456-7899
- 123-456-7899
- 123 456 7899
- 1234567899
supported
Try this
function validatePhone(phoneNumber){
var phoneNumberPattern = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
return phoneNumberPattern.test(phoneNumber);
}
For Italian Phone number:
/^([+]39)?((3[\d]{2})([ ,\-,\/]){0,1}([\d, ]{6,9}))|(((0[\d]{1,4}))([ ,\-,\/]){0,1}([\d, ]{5,10}))$/
- +39 347 12 34 567
- 347-1234567
- 347/1234567
- 347 123456
- 3471234567
- 02/1234567
- 051 12 34 567
supported