Multiselect gives me everything that starts with the selected variable

I have a template variable with the dropdown something like this -
data1, data2, data3, …data9, data10, data11, data12, data13, …data19, data20 and so on
When I select just one of this say data1, I get the desired result. But when I select 2 or more of this, say data1 and data10, I get the output for everything that starts with data1 like data1, data10, data11, data12, data13,… data19. How can I just get what I selected ?

Data source - influxdb
Query looks like instance =~ /$vm_id$/

What version of Grafana are you using?

Grafana Version - 4.2.0

Strange unable to replicate here:
http://play.grafana.org/dashboard/db/influxdb-templated-queries?panelId=1&fullscreen&edit&orgId=1&var-datacenter=America&var-host=10.1.100.1&var-host=server1&var-summarize=1m

There is a host with value 10.1.100.10 as well and does not get included. The filter expression is "hostname" =~ /^$host$/

I can see that. I tried the same filter expression and it didn’t change anything. It is dependent on data source?

No the example I showed was using InfluxDB same as you.

When I test regex it should not match on partial matches but only complete matches. The multi match regex grafana builds looks like this (data1|data20) (if data1 and data20 is selected). Which should be a full regex like =~/^(data1|data2)$/ (if you used the variable like=~/^$vm$/`

This does not match on partial matches. only data1 and data2 should be matched. Maybe a bug in your InfluxDB version?
https://regex101.com/r/gSvxes/2

I’m using InfluxDB shell version: 1.2.2

Strange, using same version on play site, did you try to modify the regex condition so that starts with /^

yes, here is my query
SELECT last(“value”) FROM “measurement” WHERE “type_instance” = ‘metric’ and host =~ /^$host_id$/ and instance =~ /^$vm_id$/ GROUP BY groupbyfactor

Did this problem ever get identified/fixed? I am having the same issue as the original poster. I am using Version 4.2 and influxdb 1.2 and am trying to use templating with regex and the multiselect

My data is setup with 128 fieldkeys with a naming pattern like this:
XXX_a, XXX_w, XXX_wh, XXX_dwh, YYY_a, YYY_w, YYY_wh, YYY_dwh, and so on. I am trying to filter out everything but the “_w” field keys.
My regex is this setup like this: /^(?!abc|._wh|._a|.*_dwh)/
and my query: SELECT mean(/^$current$/) FROM “energy” WHERE $timeFilter GROUP BY time(1m) fill(null)

The multiselect list has the correct fieldkeys listed, only items that end in “_w”. If I only select one item from the list everything works fine. But when I select multiple items the query also pulls the “_wh” field keys for all items selected but the last one.

XXX_w
XXX_wh
YYY_w
YYY_wh
ZZZ_w

I have also noticed it seems to be pulling in any fieldkeys that have a partial name match to one of the selected items. if I select items XXX_w and ZZZ_w I get the following returned.

XXX_w
XXX_wh
YYYZZZ_w
ZZZ_w

Any help would be appreciated.

maybe an influxdb issue? Have you found anything wrong with the query Grafana sends to InfluxDB?