Template variables + regex-based value mapping

Newcomer to Grafana here.

I have created a repeating panel based on a variable. The repeating works fine, but I also need to show or hide data in the graph based on the same variable.

What would work for me is to use the field override and show the field based on the result of a regex that uses the variable. Here’s an example. Previous to this all colors are transparent.

However this does not seem to work. I would be grateful if someone could confirm if variables are allowed in this context and if so how to go about it.

If I just type one of my field names in the regex it works.

The Grafana version we use is v8.4.2

I wouldn’t expect value-mapping, and especially regex-based value mapping to be fully interoperable with template variables. regex-based mapping is relatively new, while template variables are probably among the most sophisticated frontend logic in Grafana. Bummer, but not surprised that this doesn’t work.