escape-string-regexp
npmv5.0.0Escape RegExp special characters
Not recommended for new projects
No — escape-string-regexp should not be adopted for new projects. Last published 1971 days ago.
- AAdoption: grade A, Excellent.
316.5M downloads per week and 8 known dependents.
- FMaintenance: grade F, Failing.
Last published 1971 days ago.
- AWeight: grade A, Excellent.
Zero runtime dependencies, about 3.6 KB installed.
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding escape-string-regexp to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Compatibility
- Node.js
- node >=12
- Module format
- ESM only
- TypeScript
- No bundled types
- Install scripts
- None
Quick start
A usage example from the escape-string-regexp README.
import escapeStringRegexp from 'escape-string-regexp';
const escapedString = escapeStringRegexp('How much $ for a 🦄?');
//=> 'How much \\$ for a 🦄\\?'
new RegExp(escapedString);escape-string-regexp vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| escape-string-regexpthis page | 316.5M | 8 | MIT | 5 years ago |
| anymatch | 0 | 1 | ISC | 1 day ago |
| is-glob | 137.4M | 3 | MIT | 1 day ago |
| is-regex | 75.1M | 1 | MIT | 1 day ago |
| is-extglob | 0 | 1 | MIT | 1 day ago |
| jsesc | 0 | 1 | MIT | 1 day ago |
Dependencies
Declared by escape-string-regexp v5.0.0. Runtime dependencies are installed with the package; dev dependencies are not.
Dev (3)
Used by
Popular packages that depend on escape-string-regexp.
An AST-based pattern checker for JavaScript.
Reactive Extensions for modern JavaScript
Captures and cleans stack traces
Expo Router is a file-based router for React Native and web applications.
Launch latest Chrome with the Devtools Protocol port open
Launch latest Edge with the Devtools Protocol port open
Runtime typescript and ESM support for Node.js
React Native WebView component for iOS, Android, macOS, and Windows
Relationship graph
Dependencies (left) and dependents (right) of escape-string-regexp.
Frequently installed together
Native navigation primitives for your React Native app.
Error overlay for universal Expo apps.
React Server Components bindings for DOM using Webpack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.
Tools for making advanced Metro bundler features work
React Native for Web
Declarative API exposing native platform touch and gesture system to React Native
Simple and complete React Native testing utilities that encourage good testing practices.
More powerful alternative to Animated library for React Native.
The Expo SDK
TypeScript definitions for node
Fast deep equal
Lightweight debugging utility for Node.js and the browser
Release history
No releases in the last two years, typically about 162 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 5.0.0latest | 5 years ago | 3.6 KB | MIT |
| 4.0.0 | 6 years ago | 3.7 KB | MIT |
| 3.0.0 | 6 years ago | 3.7 KB | MIT |
| 2.0.0 | 7 years ago | 3.2 KB | MIT |
| 1.0.5 | 10 years ago | — | MIT |
| 1.0.4 | 10 years ago | — | MIT |
| 1.0.3 | 11 years ago | — | MIT |
| 1.0.2 | 12 years ago | — | MIT |
| 1.0.1 | 12 years ago | — | MIT |
| 1.0.0 | 12 years ago | — | MIT |
Overview
escape-string-regexp is an npm package that escape RegExp special characters. It is extremely widely used, with about 316.5M downloads per week and 8 known dependents in the graph. The latest version is 5.0.0, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need escape RegExp special characters and value a battle-tested, widely-adopted solution.
When not to use it
Consider an alternative if you need to have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.
Pros
- Large, well-established user base (316.5M weekly downloads).
- Clear open-source license (MIT).
- Lean dependency tree (3 direct dependencies).
Cons
- No bundled TypeScript types (may require a separate @types package).
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Funding
Frequently asked questions
Should I use escape-string-regexp?
No — escape-string-regexp should not be adopted for new projects. Last published 1971 days ago.
How do I install escape-string-regexp?
Run `npm install escape-string-regexp` to add escape-string-regexp to your npm project.
What license is escape-string-regexp released under?
escape-string-regexp is distributed under the MIT license.
How popular is escape-string-regexp?
escape-string-regexp has approximately 316,540,949 downloads per week and 8 known dependent packages.
Is escape-string-regexp still maintained?
The most recent release of escape-string-regexp (v5.0.0) was published 5 years ago.
Does escape-string-regexp run install scripts?
No. escape-string-regexp does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.