# @so1ve/escape-string-regexp

> > Escape RegExp special characters

Latest version **5.0.0** (published 2022-08-18) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @so1ve/escape-string-regexp
pnpm add @so1ve/escape-string-regexp
yarn add @so1ve/escape-string-regexp
bun add @so1ve/escape-string-regexp
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2022-08-18 |
| First published | 2022-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ray |
| Maintainers | so1ve |

## Links

- npm: https://www.npmjs.com/package/@so1ve/escape-string-regexp
- Repository: https://github.com/so1ve/escape-string-regexp
- Homepage: https://github.com/so1ve/escape-string-regexp#readme
- Issues: https://github.com/so1ve/escape-string-regexp/issues
- npm.io page: https://npm.io/package/@so1ve/escape-string-regexp

## Recent versions

- 5.0.0 (latest) — 2022-08-18

## README

# @so1ve/escape-string-regexp

> Escape RegExp special characters

## Install

```
$ npm install @so1ve/escape-string-regexp
```

## Usage

```js
import escapeStringRegexp from "@so1ve/escape-string-regexp";

const escapedString = escapeStringRegexp("How much $ for a 🦄?");
// => 'How much \\$ for a 🦄\\?'

new RegExp(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.

---
_Source: https://npm.io/package/@so1ve/escape-string-regexp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
