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 regex101.com (configured to Golang), nothing is working.
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?
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:
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.
I also tested several regular expressions, but each time without success (even verified with regex101.com). 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 ?
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:
/.*=brve_(\d+)_p1,.*/
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).