Use variables in regex substitution


I have a service with multiple regex substitution headers that are all based on the host header, generating a URL that uses the host header. I am wondering if I can use variables like in the regex substitution, and if so, how do a go about it? It seems like that field is interpreted as a regex string, so it is not clear how I would insert a variable and have it used. The goal would be a single regex substitution rather than one for every domain that is configured for the service.