Created
September 15, 2016 09:22
-
-
Save bugventure/f1d7997c2bb6e56981389fdd73d762ae to your computer and use it in GitHub Desktop.
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
// Source: http://stackoverflow.com/questions/2593637/how-to-escape-regular-expression-in-javascript | |
RegExp.quote = function(str) { | |
return (str+'').replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment