1.5 KiB
1.5 KiB
title | description | menu | weight | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
regexp.quoteMeta() function | `regexp.quoteMeta()` escapes all regular expression metacharacters in a string. |
|
101 |
regexp.quoteMeta()
escapes all regular expression metacharacters in a string.
Function type signature
(v: string) => string
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
Parameters
v
({{< req >}}) String that contains regular expression metacharacters to escape.
Examples
Escape regular expression metacharacters in a string
import "regexp"
regexp.quoteMeta(v: ".+*?()|[]{}^$")// Returns "\.\+\*\?\(\)\|\[\]\{\}\^\$"