Filter ._value with a variable

Hi

I have a variable called OF1 which has different values. I have two fields and I want to filter the value of one of the fields. Is it possible to filter it via regular expressions? This is what I have try.

|> filter(fn: (r) => r[“_field”] == “Valor” and r[“_value”] =~ /^${OF1}:regex}$/)

Thanks

Looks like you have an extra } in your expression…Try this:

|> filter(fn: (r) => r["_field"] == “Valor” and r["_value"] =~ /^${OF1:regex}$/)
1 Like

It doesn’t work. I removed the extra “}”

I don’t know why, but I can filter it by tags but when it comes to _value it doesn’t work