Variable interpolation in a regex.

Valentin V. Bartenev ne at vbart.ru
Tue Sep 4 20:03:03 UTC 2012


On Tuesday 04 September 2012 23:55:07 Harish Sundararaj wrote:
> Hello All,
> 
> I have a map block:
> 
>         map $http_cookie $myVal {
>                 "~adq_cnv(\d+)=($cmpid[^;]+#(?P<DC>\w{2}))(?:;|$)" $DC;
>                 default "XYZ";
>         }
> 
[...]
> 
> But that is not working. I tried different variations like : ${cmpid},
> \$cmpid . But to no luck.
> 
> Any help would be appreciated.

Regular expressions in config file are compiled at the configuration phase, so 
you can't use variables there.

 wbr, Valentin V. Bartenev



More information about the nginx mailing list