Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var x = {
regexEscapes: function (str) {
str = str.replace(/\//g, "\\/");
str = str.replace(/\?/g, "\\?");
return str;
var val = x.regexEscapes("/test/this/here?for=now");
var regexp = new RegExp(val, "i");
console.log(val, regexp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment