escape-string-regexp (1.0.5)

Published 2026-02-24 13:56:06 +00:00 by atheaadmin

Installation

registry=
npm install escape-string-regexp@1.0.5
"escape-string-regexp": "1.0.5"

About this package

escape-string-regexp Build Status

Escape RegExp special characters

Install

$ npm install --save escape-string-regexp

Usage

const escapeStringRegexp = require('escape-string-regexp');

const escapedString = escapeStringRegexp('how much $ for a unicorn?');
//=> 'how much \$ for a unicorn\?'

new RegExp(escapedString);

License

MIT © Sindre Sorhus

Dependencies

Development Dependencies

ID Version
ava *
xo *

Keywords

escape regex regexp re regular expression string str special characters
Details
npm
2026-02-24 13:56:06 +00:00
0
Sindre Sorhus
MIT
1.5 KiB
Assets (1)
Versions (3) View all
4.0.0 2026-02-24
1.0.5 2026-02-24
2.0.0 2026-02-24