Skip to content

Instantly share code, notes, and snippets.

@bigeasy
Created October 4, 2012 15:35
Show Gist options
  • 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