Compare variable got from location with set of strings

Jonathan Matthews contact at jpluscplusm.com
Mon Sep 23 23:14:57 UTC 2013


On 23 September 2013 11:03, Vil Surkin <vill.srk at gmail.com> wrote:
> Hello,
>
> I have some location in configuration like this:
> location ~ /([A-z]+_[A-z0-9]+) {
>  … do something (got $1) …
> }
>
> And i need to compare this '$1' with a set of strings. How can i do this?

Use a named capture in the location line and the resulting variable
won't get clobbered like a $1 would.

HTH,
Jonathan



More information about the nginx mailing list