Last active
December 22, 2015 01:59
-
-
Save blooski/6400477 to your computer and use it in GitHub Desktop.
Validate Phone Number - multiple formats regex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validatePhone(phone) { | |
var reg = /^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/; | |
return reg.test(phone); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment