Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
552 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | # escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp)
|
---|
| 2 |
|
---|
| 3 | > Escape RegExp special characters
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | ## Install
|
---|
| 7 |
|
---|
| 8 | ```
|
---|
| 9 | $ npm install --save escape-string-regexp
|
---|
| 10 | ```
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 | ## Usage
|
---|
| 14 |
|
---|
| 15 | ```js
|
---|
| 16 | const escapeStringRegexp = require('escape-string-regexp');
|
---|
| 17 |
|
---|
| 18 | const escapedString = escapeStringRegexp('how much $ for a unicorn?');
|
---|
| 19 | //=> 'how much \$ for a unicorn\?'
|
---|
| 20 |
|
---|
| 21 | new RegExp(escapedString);
|
---|
| 22 | ```
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | ## License
|
---|
| 26 |
|
---|
| 27 | MIT © [Sindre Sorhus](http://sindresorhus.com)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.