Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] implement a $location variable

David Gwynne
October 16, 2012 07:44PM
On 17/10/2012, at 12:46 AM, Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Tue, Oct 16, 2012 at 11:16:00PM +1000, David Gwynne wrote:
>
> [...]
>
>>>> + if (clcf->regex) {
>>>> + rc = ngx_regex_exec(clcf->regex->regex, &r->uri, captures, 3);
>>>> +
>>>> + if (rc == NGX_REGEX_NO_MATCHED) {
>>>> + return NGX_ERROR;
>>>> + }
>>>> +
>>>> + v->data = r->uri.data + captures[0];
>>>> + v->len = captures[1] - captures[0];
>>>
>>> Note that result is actually unstable in the regexp location case,
>>> as the code re-executes regular expression against a possibly
>>> changed URI.
>>
>> is there a way to keep the equivalent of $0 around after the original regex is run?
>
> It can be easily done without any additional code, using named
> captures:
>
> location ~ ^(?<matched>/foo|/bar) {
> # here one can use $matched
> }

i can live with that. i would still like a $location variable though. it simplifies the creation of reusable blocks for front end controllers. i can provide an example if you want. should i respin the diff without the regex bits?

dlg
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] implement a $location variable

David Gwynne 1290 October 14, 2012 09:24PM

Re: [PATCH] implement a $location variable

Maxim Dounin 535 October 15, 2012 10:54AM

Re: [PATCH] implement a $location variable

David Gwynne 590 October 16, 2012 09:18AM

Re: [PATCH] implement a $location variable

Maxim Dounin 573 October 16, 2012 10:48AM

Re: [PATCH] implement a $location variable

David Gwynne 583 October 16, 2012 07:44PM

Re: [PATCH] implement a $location variable

David Gwynne 447 January 03, 2013 08:24PM

Re: [PATCH] implement a $location variable

António P. P. Almeida 431 January 03, 2013 09:00PM

Re: [PATCH] implement a $location variable

António P. P. Almeida 461 January 03, 2013 09:12PM

Re: [PATCH] implement a $location variable

David Gwynne 411 January 03, 2013 09:20PM

Re: [PATCH] implement a $location variable

António P. P. Almeida 485 January 04, 2013 04:06AM

Re: [PATCH] implement a $location variable

David Gwynne 462 January 04, 2013 05:36AM

Re: [PATCH] implement a $location variable

António P. P. Almeida 666 January 04, 2013 06:08AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 141
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready