npm.io
1.0.1 • Published 1 year ago

string-escape-regex

Licence
MIT
Version
1.0.1
Deps
0
Size
2 kB
Vulns
0
Weekly
0
Stars
1

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