Welcome! Log In Create A New Profile

Advanced

Re: Regex positional capture in map

Maxim Dounin
November 03, 2014 07:24PM
Hello!

On Mon, Nov 03, 2014 at 11:02:23PM +0100, B.R. wrote:

> On Mon, Nov 3, 2014 at 3:22 PM, Igor Sysoev <igor@sysoev.ru> wrote:
>
> > Using named captures works (as demonstrated by
> > https://stackoverflow.com/questions/12459518/nginx-extract-a-value-from-a-variable-or-any-string),
> > though:
> > map $host $foo {
> > "~*^www\.(?<domain>.*)$" $domain; # Named capture wins
> > default $foo;
> > }
> >
> >
> > default $host;
> >
> > ​Yup, my bad: typo while writing the example map.​
> It does not interfere much with the problem though. Any piece of advice? :o)

As you already found yourself, map{} doesn't allow to use
positional captures in resulting values. Use named captures
instead.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Regex positional capture in map

B.R. November 03, 2014 09:06AM

Re: Regex positional capture in map

B.R. November 03, 2014 09:20AM

Re: Regex positional capture in map

Igor Sysoev November 03, 2014 09:24AM

Re: Regex positional capture in map

B.R. November 03, 2014 05:04PM

Re: Regex positional capture in map

Maxim Dounin November 03, 2014 07:24PM

Re: Regex positional capture in map

B.R. November 04, 2014 02:48AM

Re: Regex positional capture in map

Francis Daly November 03, 2014 06:06PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 201
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