Skip to content

escapeRegExp ​

文字列 str の正規表現メタ文字をエスケープし、エスケープ後の文字列を返します。

Added in v0.0.2

Usage ​

ts
import { escapeRegExp } from 'parsnip-kit'

escapeRegExp('hello world')
// 'hello world'

escapeRegExp('${name}')
// '\\$\\{name\\}'

API ​

Arguments ​

ArgTypeOptionalDefaultDescription
strstringfalseundefinedエスケープする文字列

Returns ​

Type
string