Regex from data source variable

I have multiple prometheus datasource (named - someprefix_region1, someprefix_region2).
Made a datasource variable ($region).
historically, one of the prometheus has a metric - somemetric{location=region}
how in Grafana can I cut off a prefix(someprefix_) from the variable $region and use it in the location label?

Try this:

/.someprefix_([^:]+)/

how to fit this into a request for a metric?
somemetric{location~=${region:/.someprefix_([^:]+)/}} - so of course it doesn’t work

Put the filter in the variable and use the variable to query the metrics