Regex positional capture in map
B.R.
reallfqq-nginx at yahoo.fr
Tue Nov 4 07:46:18 UTC 2014
Thanks to both of you!
Documentation bug, then...
---
*B. R.*
On Tue, Nov 4, 2014 at 1:22 AM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> 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 at 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 at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141104/0860cc0c/attachment.html>
More information about the nginx
mailing list