Hello I'd like to create a variable with label_value
and then replace the label by some regexp. The value
should be entire string, the text
should be only part which starts with uppercase (e.g. ManualAllocationPolicy:pending
. I guess the regular expression is quite good, but it's not displayed as I want. What am I missing? Grafana version is 9.4.7
This is more of the regex problem, then Grafana problem. Your application of alteration for regex is incorrect: in case of alteration only one of groups will be matched (text
in your exact case).
To match same text multiple times you'll need to employ a trick: capturing groups inside of lookaheads.
Your regex will look like this: ^(?=.*?(?<text>[A-Z].*))(?<value>.+)
For metric name
elasticsearch_sync_queue_lowerlevelgiberishManualAllocationPolicy:pending
It will produce two groups:
ManualAllocationPolicy:pending
elasticsearch_sync_queue_lowerlevelgiberishManualAllocationPolicy:pending
Demo of this regex matching online here. Matched groups can be seen on the right panel.