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

 string1_dev_01_08_2020  
 string1_prod_01_08_2020
 string2_prod_02_08_2020

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

Final value something like

 string1_*_01_08_2020  
 string1_*_01_08_2020
 string2_*_02_08_2020

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.