Skip to content

Instantly share code, notes, and snippets.

@bmansk8
Created April 2, 2019 16:12
Show Gist options
  • Save bmansk8/4d710a0fa62d2cae1447bc9db23899d5 to your computer and use it in GitHub Desktop.
Save bmansk8/4d710a0fa62d2cae1447bc9db23899d5 to your computer and use it in GitHub Desktop.
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