UNPKG

cspell-lib

Version:

A library of useful functions used across various cspell tools.

9 lines 300 B
/** * 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