Grafana templating - reduce legend spacing

Dear friends,

I have a simple Regex query inside Grafana and the panel is displayed as below. Is there a way I can reduce the legend to just display a.b.c
For example: raritansensor.measuurementsoutletsensorvalue.1.1.5 to be displayed as
1.1.5 alone

Regex SQL: SELECT /^measurementsOutletSensorValue.1.[0-9]*.5$/ FROM “raritansensor”

There are atleast 40+ sensors and hence chose the Regex route rather than selecting individual fields

You will have to do that in the query, maybe string replace?

If a Regular Expression works in Select-AS clause, then something like this would be great but the below doesn’t work

SELECT /^sensorValue.1.[0-9].5$/ AS "/^1.[0-9].5$/" FROM “measurement”

Try “.” instead of “\.”, because this is a regex.