Skip to content

Instantly share code, notes, and snippets.

@chestozo
Created June 15, 2012 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chestozo/2937233 to your computer and use it in GitHub Desktop.
Save chestozo/2937233 to your computer and use it in GitHub Desktop.
Regexp with `g` flag #regexp #flags
"a=1&b=2".match(/[a-z]=\d/i) // --> ["a=1"]
"a=1&b=2".match(/[a-z]=\d/gi) // --> ["a=1", "b=2"]
"a=1&b=2".match(/[a-z]=(\d)/i) // --> ["a=1", "1"]
"a=1&b=2".match(/[a-z]=(\d)/gi) // --> ["a=1", "b=2"] - !!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment