Escape RegExp special characters
$ npm install escape-string-regexp
const escapeStringRegexp = ;const escapedString = ;//=> 'How much \\$ for a 🦄\\?'escapedString;
You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.