escapeRegExp
Escapes the regular expression metacharacters in string str
and returns the escaped string.
Added in v0.0.2
Usage
ts
import { escapeRegExp } from 'parsnip-kit'
escapeRegExp('hello world')
// 'hello world'
escapeRegExp('${name}')
// '\\$\\{name\\}'
API
Arguments
Arg | Type | Optional | Default | Description |
---|---|---|---|---|
str | string | false | undefined | The string to escape |
Returns
Type |
---|
string |