Created
March 24, 2017 21:29
-
-
Save aradnom/2fafed06d37c7dab7256e1d9b87d662b to your computer and use it in GitHub Desktop.
Parse a phone number with regex. May take some finessing with a few formats, but will attempt to parse country code, area code and number.
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
/(\d{1,3})?(\s|-|\.)?\(?(\d{3})?\)?(\s|-|\.)?(\d{3})(\s|-|\.)?(\d{4})/.exec( string ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment