Trying to change panel label with regex or similar

Using Grafana 9.5.2 on Debian Bullseye 5.15.108-1

I want to change the labels for my chart data. I would like to use a substring of an existing tag: $tag_friendly_name

This tag has results e.g. thp_bedroom_temperature and I just want to extract the room name: i.e. bedroom.

I know I could do this with an override but I have many such graphs and it would be much easier to do this procedurally if this is possible. I have seen many postings where people are trying to do something similar but I cannot find the solution. I am hoping that it is a case of entering a special string in the ALIAS field to be able this.

If anyone can help, it would be much appreciated.

Thanks in advance!

Try to use transformation Rename by regex: Transform data | Grafana documentation

Thanks very much for the pointer. Been trying to do this for a while.

I acheived what I wanted with the Match: thp_(.*)_.*

One final optimisation would be to capitalise the first letter of the new string (ie bedroom → Bedroom, kitchen → Kitchen …).

Any idea of how to go about that?

Best Regards,

Jonathan