Flux Variable in regex

Hey - Is it possible to use a variable in a regex filter? - Trying to do something like this:

foo = “/cpu1|cpu2/”
|> filter …
r._field =~ foo

Hello, This is what you want: https://v2.docs.influxdata.com/v2.0/reference/flux/stdlib/regexp/compile/

import "regexp"
foo = "cpu[0-2]"
//...
  r.cpu =~ regexp.compile(v: foo)
//...