escape-string-regexp / 1.0.5 last updated 3 months ago created on Jun 24th 2014

Install

npm install --save escape-string-regexp

Clone

git clone git@github.com:sindresorhus/escape-string-regexp.git

dependencies

No dependencies listed.

maintainers

sindresorhus sindresorhus

versions 6 total

1.0.5 5 months ago jbnicolai
1.0.4 7 months ago sindresorhus
1.0.3 a year ago jbnicolai
1.0.2 2 years ago jbnicolai
1.0.1 2 years ago jbnicolai
1.0.0 2 years ago sindresorhus
202444 Downloads yesterday.

readme

escape-string-regexp Build Status

Escape RegExp special characters

Install

$ npm install --save escape-string-regexp

Usage

1
2
3
4
5
6
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

Resolving all dependencies.. This could take a while as our cache is not yet fully warmed up.