Error: repetition operator missing expression

the below works if 1 cpu is selected at a time, however if i select multiple the below error message occurs. have tried to resolve however little success…

using influxdb2 flux and grafana

from(bucket: “default”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“host”] =~ /${server}/)
|> filter(fn: (r) => r[“cpu”] =~ /${cpu}/) ← line with error
|> filter(fn: (r) => r[“_measurement”] == “system_cpu”)
|> filter(fn: (r) => r[“_field”] == “usage_system”)
|> map(fn: (r) => ({cpu: r.cpu, _time: r._time, _value: r._value * 100.0}))
|> group(columns: [“cpu”])
|> last()
|> group()
|> highestMax(n: 1, groupColumns: [“cpu”])

invalid: compilation failed: error @6:36-6:59: regex parse error: {cpu0,cpu1,cpu2,cpu3} error: repetition operator missing expression

Hello @William,
Welcome!
Can you try:

|> filter(fn: (r) => r[“cpu”] =~ r.cpu =~ /cpu[0-3]$/

Insead?