Often when trying to solve a Problem A, you encounter a Problem B which takes on a life of its own. This is such a case.
Is it possible to insert variables in VCL regex expressions? (as the regex pattern itself).
Checking the documentation:
VCL regular expression cheat sheet
Regular expressions in Fastly VCL | Fastly Documentation
Here’s what I’d suggest on both those pages.
Option 1:
Add a small footnote: “Note: It is not currently possible to use variables in regex expressions. A regex must be a string.”
or
Option 2:
Include examples in the docs covering the following situations, using variables in the regex: regsub(), a ~ b, variables concatenated with strings, variables concatenated with variables.