regexp.quoteMeta() 函数
regexp.quoteMeta() 转义字符串中的所有正则表达式特殊字符。
函数类型签名
(v: string) => string
有关更多信息,请参见 Function type signatures。
参数
v
(必填) 包含需要转义的正则表达式元字符的字符串。
示例
在字符串中转义正则表达式元字符
import "regexp"
regexp.quoteMeta(v: ".+*?()|[]{}^$")// Returns "\.\+\*\?\(\)\|\[\]\{\}\^\$"