Skip to content

Instantly share code, notes, and snippets.

@lonekorean
Last active August 29, 2015 13:55
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 lonekorean/8755777 to your computer and use it in GitHub Desktop.
Save lonekorean/8755777 to your computer and use it in GitHub Desktop.
JavaScript regex search
var s = 'abc abc abc';
alert(s.replace(/abc/, 'xyz')); // outputs 'xyz abc abc'
alert(s.replace(/abc/g, 'xyz')); // outputs 'xyz xyz xyz'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment