regexp.compile() function

The regexp.compile() function parses a regular expression and, if successful, returns a Regexp object that can be used to match against text.

Output data type: Regexp

import "regexp"

regexp.compile(v: "abcd")

// Returns the regexp object `abcd`



The string value to parse into a regular expression.

Data type: String


Use a string value as a regular expression
import "regexp"

  |> map(fn: (r) => ({
      r with
      regexStr: r.regexStr,
      _value: r._value,
      firstRegexMatch: findString(
        r: regexp.compile(v: regexStr),
        v: r._value

New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: