Skip to content

Instantly share code, notes, and snippets.

@zerosignalproductions
Last active August 29, 2015 13:56
Show Gist options
  • Save zerosignalproductions/8831113 to your computer and use it in GitHub Desktop.
Save zerosignalproductions/8831113 to your computer and use it in GitHub Desktop.
Validate a phone number allowing for the format 1-(XXX)-XXX-XXXX, but not 1XX-XXX-XXX or XXX-555-XXXX.
//https://www.debuggex.com/r/H3Wz2nlxZUJcs7sV/3
/^(\+?1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-??(?!5{3})[2-9]\d{2}-?\d{4}$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment