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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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
This topic is locked and can not be replied to.