Skip to content

Instantly share code, notes, and snippets.

@bigeasy
Created October 4, 2012 15:35
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 bigeasy/3834454 to your computer and use it in GitHub Desktop.
Save bigeasy/3834454 to your computer and use it in GitHub Desktop.
JavaScript regular expression to match regular expression special characters.
const REGEX = new RegExp('(\\' + '/ . * + ? | ( ) [ ] { } \\'.split(' ').join('|\\') + ')', 'g');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment