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
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: regexp.compile() function | Flux 0.x Documentation
import "regexp"
foo = "cpu[0-2]"
//...
r.cpu =~ regexp.compile(v: foo)
//...
You don’t need regexp.compile()
for that, you just need to set your variable like regex:
// No quotes ("") here:
foo = /cpu1|cpu2/
|> filter …
r._field =~ foo