Can you regex part of a variable in a series?

We have some variables, e.g., $env:prod, $env:prod-custom. I’d like to have some of my metrics configured to use just $env, but others to use only what comes before - in the $env variable.

e.g., consider the following two examples:

$env.my.custom.metric
$env.my.shared.metric

If I have the $env variable selected as $env == prod-custom, I’d like a way to make it so that the following are the literal series used:

prod-custom.my.custom.metric
prod.my.shared.metric

Is there a way to do this?