Forum: NGINX Compare variable got from location with set of strings

E57b2930ced30dbdefd55ae6e292f2e8?d=identicon&s=25 Vil Surkin (Guest)
on 2013-09-23 12:04
(Received via mailing list)
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?

Thanks!
34011bc56457235a2caa5ed1d4a29f3c?d=identicon&s=25 Jonathan Matthews (Guest)
on 2013-09-24 01:15
(Received via mailing list)
On 23 September 2013 11:03, Vil Surkin <vill.srk@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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.