## What this teaches

How to influxdb: chained variable regex queries are not escaped after 9.4.7.

## The problem

Issue grafana/grafana#67810 (closed, 31 comments): ### 
# What went wrong?


When using chained variables the value passed to the second variable is not properly escaped in the query sent to influxdb in versions 9.4.9 and 9.5.1. Up to 9.4.7 it was working correctly.

**What happened**:

- For a template variable configured as `Query` against an InfluxDB Data source with the following query: `SHOW TAG VALUES WITH KEY = "jolokia_agent_url" WHERE jolokia_agent_url =~/^$jvm_instance$/` the query that is sent to the query endpoint is 

`SHOW TAG VALUES WITH KEY = "jolokia_agent_url" WHERE jolokia_agent_url...

## What worked (verified answer)

[itsmylife (contributor)]: The InfluxDB variable-escaping problems were fixed across PRs leading up to 10.4.1. The reporter confirmed everything working on 10.4.1 with influxdbBackendMigration=true. Upgrade to 10.4.1 or newer and enable the influxdbBackendMigration feature flag. A separate slash-in-query edge case was split into its own issue, 86380.

## Source

gh:grafana/grafana#67810 - https://github.com/grafana/grafana/issues/67810
