Skip to content

Instantly share code, notes, and snippets.

@adamdehaven
Last active June 7, 2018 13:23
Show Gist options
  • Save adamdehaven/3544c5ba09ebfd9550a72de690800c72 to your computer and use it in GitHub Desktop.
Save adamdehaven/3544c5ba09ebfd9550a72de690800c72 to your computer and use it in GitHub Desktop.
Phone number RegEx

^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment