docs-v2/content/flux/v0/stdlib/regexp/quotemeta.md

1.5 KiB

title description menu weight
regexp.quoteMeta() function `regexp.quoteMeta()` escapes all regular expression metacharacters in a string.
flux_v0_ref
name parent identifier
regexp.quoteMeta regexp regexp/quoteMeta
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 "\.\+\*\?\(\)\|\[\]\{\}\^\$"