How to find and replace group of characters using regex in template variable grafana?

I am using a template variable to list down the values which are fetches from elasticsearch. The template variable having the values like


I want to replace all the dev and prod to * in regex field on template variable page

Final value something like


How can I achieve this in grafana?

Thanks in advance.

Nope, you can’t. Grafana just displayed the data from the source.
If you need to change the value, change from elasticsearch index. You can use mutate in logstash

mutate {
	 gsub => [
           "message", "string1_dev_", "string1_*_ ",
           "message", "string1_prod_", "string1_*_ ",
           "message", "string2_prod_", "string2_*_ "

But I suggest to copy the original fields to other field as necessary and you still have the original value.