# Regular expression problem

**URL:** <https://community.grafana.com/t/regular-expression-problem/569>\
**Category:** Dashboards\
**Tags:** influxdb\
**Created:** [April 17, 2017, 1:01am UTC](https://community.grafana.com/t/regular-expression-problem/569 "2017-04-17T01:01:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![voiprodrigo](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/voiprodrigo/32/224_2.png) [@voiprodrigo](https://community.grafana.com/u/voiprodrigo)\
**Post date:** [April 17, 2017, 1:01am UTC](https://community.grafana.com/t/regular-expression-problem/569/1 "2017-04-17T01:01:06Z")

</div>

Hi,

I’m setting up a dashboard on top of 3 different InfluxDB sources. I need to use a template variable named for example “color”. This variable will be used on multiple queries, that span those 3 sources. Unfortunately, a particular “color” may have different vales, depending on the source/measurement. For example “color” “Blue” may be named “BL” or “Blue” or “Bluu”. So, I have defined the template var with 3 constant values, “Red”, “Green” “(Blue|BL|Bluu)”. This then works in queries where [[color]] is called as part of a regexp match in a influxdb query.

The problem is when I use another template variable that references this one. The query for values of this template variable has a where clause that matches against “color”. In that case, the parenthesis and pipe characters are escaped and the regexp no longer works because it becomes a literal match.

First of all, I understand that the proper way to handle this is to make this tag values consistent across all measurements. That’s just not a practical possibility at this moment.

Any hints to get this working?

Thanks.

---

<div class="post-metadata">

**Author:** ![torkel](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/torkel/32/20_2.png) [@torkel](https://community.grafana.com/u/torkel)\
**Post date:** [April 18, 2017, 1:00pm UTC](https://community.grafana.com/t/regular-expression-problem/569/2 "2017-04-18T13:00:51Z")

</div>

> [@voiprodrigo](#):
>
> The problem is when I use another template variable that references this one. The query for values of this template variable has a where clause that matches against “color”. In that case, the parenthesis and pipe characters are escaped and the regexp no longer works because it becomes a literal match.

Not sure there is away around that. There is a feature request to disable escaping.

---

<div class="post-metadata">

**Author:** ![anon80964540](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@anon80964540](https://community.grafana.com/u/anon80964540)\
**Post date:** [January 13, 2021, 4:02pm UTC](https://community.grafana.com/t/regular-expression-problem/569/3 "2021-01-13T16:02:20Z")

</div>

Closed on January 13, 2021, 4:02pm UTC


