An open API service indexing awesome lists of open source software.

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.

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