index.d.ts 437 B

12345678910111213141516
  1. /**
  2. Escape RegExp special characters.
  3. You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
  4. @example
  5. ```
  6. import escapeStringRegexp from 'escape-string-regexp';
  7. const escapedString = escapeStringRegexp('How much $ for a 🦄?');
  8. //=> 'How much \\$ for a 🦄\\?'
  9. new RegExp(escapedString);
  10. ```
  11. */
  12. export default function escapeStringRegexp(string: string): string;