Created
June 13, 2013 22:26
-
-
Save Dottenpixel/5777922 to your computer and use it in GitHub Desktop.
RegExp Negation Example
This file contains 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
str = "(San Francisco, CA), (San Jose, CA), Palo Alto, Cupertino, (Mountain View, CA)"; | |
//> "(San Francisco, CA), (San Jose, CA), Palo Alto, Cupertino, (Mountain View, CA)" | |
str.split(/\s*,\s*(?![\w\s]*\))/) | |
//> ["(San Francisco, CA)", "(San Jose, CA)", "Palo Alto", "Cupertino", "(Mountain View, CA)"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment