regexp.matchRegexpString() function

The regexp.matchRegexpString() function tests if a string contains any match to a regular expression.

*Output data type: Boolean*

  1. import "regexp"
  2. regexp.matchRegexpString(r: /(gopher){2}/, v: "gophergophergopher")
  3. // Returns true

Parameters

r

The regular expression used to search v.

*Data type: Regexp*

v

The string value to search.

*Data type: String*

Examples

Filter by columns that contain matches to a regular expression
  1. import "regexp"
  2. data
  3. |> filter(fn: (r) =>
  4. regexp.matchRegexpString(
  5. r: /Alert\:/,
  6. v: r.message
  7. )
  8. )