docs-v2/content/v2.0/reference/flux/functions/strings/replaceall.md

988 B

title description menu weight related
strings.replaceAll() function The strings.replaceAll() function replaces all non-overlapping instances of a substring with a specified replacement.
v2_0_ref
name parent
strings.replaceAll Strings
301
/v2.0/reference/flux/functions/strings/replace

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.

Data type: String

t

The substring to replace.

Data type: String

u

The replacement for all instances of t.

Data type: String

Examples

Replace string matches
import "strings"

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