Filter the _measurements for a selection

Hi, I want to filter the _measurements in my bucket. The background is that I want to give this as a variable to choose from.

import "influxdata/influxdb/schema"

// List measurements
schema.measurements(bucket: "mgwsIotBox")

So i receive all measurements. But now i want to filter the result with an regular expression. My Idea was

|> filter(fn: (r) => r.["_measurement"] =~ /.actualPowerMeter%./)

The result should be “actualPowerMeterCurrent” and “actualPowerMeterVoltage” and so on. The measurements “activedrivecurrent” and so on where filtered.

But i receive all the time the error

compilation failed: expected RPAREN, got EOF

what am I misunderstanding?

This regex should match all strings who contain the text actualPowerMeter. You don’t need the dots and % if I understand your question correctly.

|> filter(fn: (r) => r.["_measurement"] =~ /actualPowerMeter/)

If this don’t work, add a listing of the measurement types so it’s easier to craft an regex.

@eriktar : Thanks! Simple solution. You should actually figure it out yourself.