Calling functions on variables

I have a custom variable in Grafana which controls several other datasource variables depending on the environment (dev, staging, production). Due to the inconsistencies in the namings of the different datasources, the idea is to have a list of values per option in the dropdown menu, as shown below:
image

The idea is to be able to split a particular value such as "prod,prd" into a list of values like [prod, prd] and use them in the regex to filter out the datasources. Is there a way to achieve this behavior in Grafana? Can I call functions on variables like $environment.split(",")?