docs-v2/content/flux/v0.x/stdlib/strings/replaceall.md

1.1 KiB

title description aliases menu weight related introduced
strings.replaceAll() function The strings.replaceAll() function replaces all non-overlapping instances of a substring with a specified replacement.
/influxdb/v2.0/reference/flux/functions/strings/replaceall/
/influxdb/v2.0/reference/flux/stdlib/strings/replaceall/
/influxdb/cloud/reference/flux/stdlib/strings/replaceall/
flux_0_x_ref
name parent
strings.replaceAll strings
301
/flux/v0.x/stdlib/strings/replace
0.18.0

The strings.replaceAll() function replaces all non-overlapping instances of a substring with a specified replacement.

Output data type: String

import "strings"

strings.replaceAll(v: "oink oink oink", t: "oink", u: "moo")

// returns "moo moo moo"

Parameters

v

The string value to search.

t

The substring to replace.

u

The replacement for all instances of t.

Examples

Replace string matches
import "strings"

data
    |> map(fn: (r) => ({r with content: strings.replaceAll(v: r.content, t: "he", u: "her")}))