Variable interpolation in a regex.

Harish Sundararaj tuxtoti at
Tue Sep 4 19:55:07 UTC 2012

Hello All,

I have a map block:

        map $http_cookie $myVal {
                "~adq_cnv(\d+)=($cmpid[^;]+#(?P<DC>\w{2}))(?:;|$)" $DC;
                default "XYZ";

The $cmpid used in the left side of a map is to be interpolated from a
location block :

       location ~ ^/cnv/(\d+)/ {
                 set $cmpid  $1;

But that is not working. I tried different variations like : ${cmpid},
\$cmpid . But to no luck.

Any help would be appreciated.


More information about the nginx mailing list