Current section

Files

Jump to
spellweaver priv bun node_modules cspell-lib dist lib util regexHelper.js
Raw

priv/bun/node_modules/cspell-lib/dist/lib/util/regexHelper.js

/**
* Escape a string so it can be used as an exact match within a RegExp.
* @param s - string to escape
* @returns - the escaped string.
*/
export function escapeRegEx(s) {
return s.replaceAll(/[|\\{}()[\]^$+*?.]/g, '\\$&').replaceAll('-', '\\x2d');
}
//# sourceMappingURL=regexHelper.js.map