UNPKG

@stream-io/escape-string-regexp

Version:

Escape RegExp special characters

3 lines (2 loc) 378 B
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e||self).escapeStringRegexp=n()}(this,function(){return function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}}); //# sourceMappingURL=index.umd.js.map