https://github.com/fabiospampinato/string-escape-regex
A tiny function for escaping a string to be used as the source in a regex.
https://github.com/fabiospampinato/string-escape-regex
escape regex string
Last synced: 10 months ago
JSON representation
A tiny function for escaping a string to be used as the source in a regex.
- Host: GitHub
- URL: https://github.com/fabiospampinato/string-escape-regex
- Owner: fabiospampinato
- License: mit
- Created: 2022-05-06T11:09:34.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-19T22:11:18.000Z (over 1 year ago)
- Last Synced: 2025-07-12T12:45:51.961Z (11 months ago)
- Topics: escape, regex, string
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# String Escape Regex
A tiny function for escaping a string to be used as the source in a regex.
## Install
```sh
npm install string-escape-regex
```
## Usage
```ts
import escape from 'string-escape-regex';
// Let's escape a string to be used in a regex
escape ( 'foo()' ); // => 'foo\\(\\)'
```
## License
MIT © Fabio Spampinato