bpms_site/.svn/pristine/b2/b294af60f2a3ed1b4463e2d27a984b0443eaf9ac.svn-base
2025-11-02 16:38:49 +03:30

12 lines
476 B
Plaintext

// regexp is based on https://github.com/sindresorhus/escape-string-regexp
const reHasRegExp = /[|\\{}()[\]^$+*?.-]/;
const reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g;
export function escapeStringRegexp(str) {
// see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23
if (reHasRegExp.test(str)) {
return str.replace(reReplaceRegExp, "\\$&");
}
return str;
}
//# sourceMappingURL=escape-regexp.js.map