mentalHealth/01-Web/packages/utils/common/strings.ts

11 lines
278 B
TypeScript
Raw Normal View History

2024-02-18 06:52:01 +00:00
/**
*
*
* @export
* @param {string} [string='']
* @link https://github.com/sindresorhus/escape-string-regexp
*/
export function escapeStringRegexp(string = '') {
return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
}