UNPKG

@cspell/cspell-tools

Version:
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=escapeRegEx.js.map