Skip to content

Instantly share code, notes, and snippets.

@kevinsearle
Created December 5, 2012 08:30
Show Gist options
  • Save kevinsearle/4213819 to your computer and use it in GitHub Desktop.
Save kevinsearle/4213819 to your computer and use it in GitHub Desktop.
PCRE Phone numbers
// This regex will validate a 10-digit North American telephone number.
// Separators are not required, but can include spaces, hyphens, or periods.
// Parentheses around the area code are also optional.
'/^((([0-9]{1})*[- .(]*([0-9]{3})[- .)]*[0-9]{3}[- .]*[0-9]{4})+)*$/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment