Regex measurements starting with some text is not working -FLUX

regex

#1

We have many measurements starting with say for an example “alert”. I am trying to regex with “alert” in flux language. but it is not working.
Influxdb version: 1.7.2

curl localhost:8086/api/v2/query -XPOST -sS -H ‘accept:application/csv’ -H ‘content-type:application/vnd.flux’ -d ‘from(bucket:“gs”) |> range(start:-5h) |> filter(fn:® => r._measurement == "/^alert(.*)/)’


#2

Hey @gowrisankar22,

In order to match on a regular expression, you need to use =~ in-place of ==.

Should you wish to read more on this, you can find our documentation here.

Have a great day!


#3

Thanks a lot :slight_smile: … It did the trick.