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

1007 B

title description aliases menu weight introduced
regexp.quoteMeta() function The `regexp.quoteMeta()` function escapes all regular expression metacharacters inside of a string.
/influxdb/v2.0/reference/flux/functions/regexp/quotemeta/
/influxdb/v2.0/reference/flux/stdlib/regexp/quotemeta/
/influxdb/cloud/reference/flux/stdlib/regexp/quotemeta/
flux_0_x_ref
name parent
regexp.quoteMeta regexp
301 0.33.5

The regexp.quoteMeta() function escapes all regular expression metacharacters inside of a string.

Output data type: String

import "regexp"

regexp.quoteMeta(v: ".+*?()|[]{}^$")

// Returns "\.\+\*\?\(\)\|\[\]\{\}\^\$"

Parameters

v

The string that contains regular expression metacharacters to escape.

Examples

Escape regular expression meta characters in column values
import "regexp"

data
    |> map(fn: (r) => ({r with notes: r.notes, notes_escaped: regexp.quoteMeta(v: r.notes)}))