|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
467 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | Escape RegExp special characters.
|
|---|
| 3 |
|
|---|
| 4 | You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
|
|---|
| 5 |
|
|---|
| 6 | @example
|
|---|
| 7 | ```
|
|---|
| 8 | import escapeStringRegexp = require('escape-string-regexp');
|
|---|
| 9 |
|
|---|
| 10 | const escapedString = escapeStringRegexp('How much $ for a 🦄?');
|
|---|
| 11 | //=> 'How much \\$ for a 🦄\\?'
|
|---|
| 12 |
|
|---|
| 13 | new RegExp(escapedString);
|
|---|
| 14 | ```
|
|---|
| 15 | */
|
|---|
| 16 | declare const escapeStringRegexp: (string: string) => string;
|
|---|
| 17 |
|
|---|
| 18 | export = escapeStringRegexp;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.