shoetest
Version:
Powerful string matching insensitive to diacritics, special characters, symbols and case
18 lines • 638 B
TypeScript
/**
* Safely escape special regex characters
*
* Converts special regex characters to their literal equivalents by adding
* backslashes, making the string safe to use in regex patterns.
*
* @param str - Text containing potential regex special characters
* @returns Escaped text safe for regex use
*
* @example
* ```typescript
* escape('Hello (world)'); // → 'Hello \\(world\\)'
* escape('Price: $5.99'); // → 'Price: \\$5\\.99'
* escape('.*+?^${}()|[]\\'); // → '\\.\\*\\+\\?\\^\\$\\{\\}\\(\\)\\|\\[\\]\\\\'
* ```
*/
export declare function escape(str: string): string;
//# sourceMappingURL=regexp.d.ts.map