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?

I’m trying to resolve query but getting error
invalid: compilation failed: error at @5:40-5:154: regex parse error: {Australia,Canary Island,India,Ireland,Italy,Mexico,Netherland,Netherlands,Poland,Portugal,Spain,United Kingdom} error: repetition operator missing expression

when i run query on perticuler region then i’m getting result with proper data but when i was trying to run query on all region getting above error

even i try operator .* still getting error
can someone help me
from(bucket: “Default”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “HttpResponse”)
|> filter(fn: (r) => r[“_field”] == “http_response_code”)
|> filter(fn: (r) => r[“Country”] =~ /${Territory}/ and r[“status_code”] =~ /200/)
|> group(columns: [“status_code”,“Territory”], mode:“by”)
|> keep(columns: [“_time”, “_value” , “Country”])
|> count()