Variable interpolation in a regex.

Harish Sundararaj tuxtoti at gmail.com
Tue Sep 4 20:46:24 UTC 2012


Hi Valentin,
Thanks. Is there any way to achieve the same thing through some other
means, even if it takes a hit on the performance ?

Thanks
Harish

On Wed, Sep 5, 2012 at 1:33 AM, Valentin V. Bartenev <ne at vbart.ru> wrote:
> 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
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list