escape-string-regexp-browser
Version:
Escape RegExp special characters
1 lines • 173 B
JavaScript
;module.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};