foxts
Version:
Opinionated collection of common TypeScript utils by @SukkaW
12 lines (10 loc) • 628 B
TypeScript
/**
* Escape characters with special meaning either inside or outside character sets.
* Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
*
* When the `unicodeMode` is `true` (default), the `-` character is escaped as `\x2d` to ensure compatibility with Unicode patterns, PCRE, and MongoDB.
*
* You should disable this option if you are using JavaScript regular expressions without the `u` flag.
*/
declare function escapeStringRegexp(str: string, unicodeMode?: boolean): string;
export { escapeStringRegexp };