docs-v2/content/v2.0/reference/flux/functions/regexp/getstring.md

837 B

title description menu weight related
regexp.getString() function The `regexp.getString()` function returns the source string used to compile a regular expression.
v2_0_ref
name parent
regexp.getString Regular expressions
301
/v2.0/reference/flux/functions/regexp/compile

The regexp.getString() function returns the source string used to compile a regular expression.

Output data type: String

import "regexp"

regexp.getString(r: /[a-zA-Z]/)

// Returns "[a-zA-Z]"

Parameters

r

The regular expression object to convert to a string.

Data type: Regexp

Examples

Convert regular expressions into strings in each row
import "regexp"

data
  |> map(fn: (r) => ({
      r with
      regex: r.regex,
      regexStr: regexp.getString(r: r.regex)
    })
  )