Card #3394 · Grafana
Incorrect escaping of regex and special characters in template variables
Users are experiencing issues where template variables containing regex or special characters are automatically escaped, turning them into literal matches. This prevents the intended regular expression logic from working in queries and panels across various data sources.
Pain score
0.20/ 1.00 · weighted product of four components
Reach1.00distinct authors (log-normalized)
Recency1.00freshness decay, half-life months
Engagement0.95upvotes + comments, normalized
Monetization0.25willingness-to-pay cues in evidence
§ Evidence — 4 verified quotes
In that case, the parenthesis and pipe characters are escaped and the regexp no longer works because it becomes a literal match.
When I look in inspector whole variable is escaped, I’ll give example, for constant variable query_var value: hostname.keyword: host-02 In query inspector I get query.data : "query":"hostname.keyword\\:\\\"host\\-02\\\""
The value sent in the http API call to Prometheus replaces the stack=~"$stack" with stack%3D~%22.%22 (Note the missing escape value for + ).
There is a feature request to disable escaping.
Comments are a Pro feature — join the conversation, share what you've shipped, hear what others are building.
Upgrade to Pro