JSPM

string-escape-regex

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20289
  • Score
    100M100P100Q152028F
  • License MIT

A tiny function for escaping a string to be used as the source in a regex.

Package Exports

  • string-escape-regex

Readme

String Escape Regex

A tiny function for escaping a string to be used as the source in a regex.

Install

npm install string-escape-regex

Usage

import escape from 'string-escape-regex';

// Let's escape a string to be used in a regex

escape ( 'foo()' ); // => 'foo\\(\\)'

License

MIT © Fabio Spampinato