Created
April 26, 2017 17:25
-
-
Save NoraCodes/16da8b43ee21d230165ad023c6c6a229 to your computer and use it in GitHub Desktop.
Some Regular Expressions
This file contains hidden or 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
Phone numbers: | |
(\+[0-9]{1,3}[. -/])?\(?[0-9]{3}\)?[. -/][0-9]{3}[. -/][0-9]{4} | |
1 2 3 4 | |
Explaination: | |
1: (\+[0-9]{1,3}[. -/])? matches a country code like +1 or +999, and seperator | |
2: ?\(?[0-9]{3}\)? matches an area code with or without parentheses, like 858 or (858), and seperator | |
3: [0-9]{3}[. -/] matches an exchange number, and seperator | |
4: [0-9]{4} matches a 4-digit flop number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment