Issue with regexp to transform display name

With Grafana 10.1.5 (docker), using InfluxDB as data source.

I want to rename the field name to display it with regular expresions using transform. I want to display “Borne 1” instead of brev_1_p1.

I read and tried with official documentation (and read a lot of posts in community, but without any success): Transform data | Grafana documentation

When using transform, with specifying anything, the field name disappear even if the default regex is (.*) and replacement is $1. Even if I try any regex verified with (configured to Golang), nothing is working.

Any help would be appreciated.

Welcome @slavirotte to the Grafana forum.

I also have found the Rename by Regex transformation to be tricky, but eventually I have gotten it to work. I will try to hammer out yours, but in the meantime, could you use the Organize Fields transformation?

Can you try this?
Match: /brve_ ([^_]+)\_p1 value/
Replace: Borne $1

From your first screenshot, I could not see the full legend name (it was truncated), but that should be able to be trimmed off as well.

Thanks for you reply. Unfortunatly, none of the suggestions are working for me.

If I try with" Organize fields" as transformation, I’ve got the following error:
“Organize fields only works with a single frame. Consider applying a join transformation or filtering the input first.”

And the regex is not working.

The field name is brve_1_p1 and I have 12 of them (brve_1_p1, brve_2_p1 … brve_12_p1). In his example, as I select on the location tag, I only have 8 of them.

One the tab view, I’ve got the following information:

and with the list of all measurements:

What’s suspicious for me is when I activate the transformation, with the (.) or /(.)/ expression and the $1 replacement, I no longer have a name and just value {building=“P”…}

For previous dashboards, I’ve used override fields, but I have to specify the “Display name” in hard copy for each one and the regexes don’t work.

In this case, I really need to use regexes because there are currently 12 electric vehicle charging points, but there will be more in the near future and I want my dashboard to work regardless of the number of points.

Thank you in advance for any help.

Hi @slavirotte

How about this?

Match: brev_(\d+)_p1
Replace: Borne $1

Seems to work in Regex101:

Also, for reasons that are not clear to me, maybe you must add the slashes, like this:


No, it does not work at all.

I also tested several regular expressions, but each time without success (even verified with In fact, if the expression matches, $1 is empty.

If I put:
Match: brve_(\d+)_p1
Replace: Borne $1
there is no name changes for brve_1_p1

If I put:
Match: /brve_(\d+)_p1/
Replace: Terminal $1
I only have value {building=…} for the 8 terminals

I suspect a bug, not just misuse. What do you thing of that ?

What if you used a string function in the flux query itself

What is the full label here (when no transformation is being used)? I can see {b…

My feeling is that something like this should work:

Match: /brve_(\d+)_p1 value {b... whatever else comes here /
Replace: Borne $1

Here are some Regex examples that I have working on my end. In both cases, the word Hydro, Wind or Nuclear is all that remains in the legend after applying the Rename by Regex.

Example 1:
/value {fueltype="([^"]+)"(?:.*)"}/

Example 2:
/ElectricPowerGeneratedByEnergySource.sum {fueltype: ([^}]+)\}/

I guess you are testing wrong string, so you are testing wrong regex. Try:


It is nice to save for people what are you testing - here you are - regex101: build, test, and debug regex - I guess minor adjustments will be needed (I’m lazy to rewrite full string from picture, sorry).

Thanks a lot grant2 and jangaraj !

Creating a regexp to match the “value {building=”…“…}” part of the “name” was the right solution.

Matching: /.*item=\"brve_(\d+)_p1\",.*/
Replace: Borne $1

Many thanks to you both.

1 Like