Created
April 2, 2019 16:12
-
-
Save bmansk8/4d710a0fa62d2cae1447bc9db23899d5 to your computer and use it in GitHub Desktop.
This file contains 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 telephoneCheck(str) { | |
// Good luck! | |
var regex = /^(1\s?)?(\(\d{3}\)|\d{3})[\s\-]?\d{3}[\s\-]?\d{4}$/; | |
return regex.test(str); | |
} | |
telephoneCheck("555-555-5555"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment