Last active
January 4, 2016 14:39
-
-
Save Chryus/8635492 to your computer and use it in GitHub Desktop.
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
> var reg = /([a-zA-Z\s]+) ([A-Z]{2})/g | |
> var string = "New York NY 10006 United States" | |
> var res = string.match(reg); | |
> console.log(res); | |
[ 'New York NY' ] | |
> var res = str.match(reg); | |
undefined | |
> res | |
[ 'New York NY' ] | |
> res.length | |
1 | |
> res[0] | |
'New York NY' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment