<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On 03 Nov 2014, at 17:18, B.R. <<a href="mailto:reallfqq-nginx@yahoo.fr">reallfqq-nginx@yahoo.fr</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Using named captures works (as demonstrated by <a href="https://stackoverflow.com/questions/12459518/nginx-extract-a-value-from-a-variable-or-any-string">https://stackoverflow.com/questions/12459518/nginx-extract-a-value-from-a-variable-or-any-string</a>), though:<br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">map $host $foo {<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">    "~*^www\.(?<domain>.*)$"    $domain; # Named capture wins<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">    default                    $foo;<br></div>}</div></div></blockquote><div><br></div><div>default  $host;</div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br>-- <br>Igor Sysoev<br><a href="http://nginx.com">http://nginx.com</a></div><div><br></div></div></div></div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature">On Mon, Nov 3, 2014 at 3:03 PM, B.R. <span dir="ltr"><<a href="mailto:reallfqq-nginx@yahoo.fr" target="_blank">reallfqq-nginx@yahoo.fr</a>></span> wrote:</div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto;"><div dir="ltr"><div style="font-size:small;color:rgb(51,51,153)"><a href="http://nginx.org/en/docs/http/ngx_http_map_module.html#map" target="_blank">map's documentation</a> states:<br>A regular expression can contain named and positional captures
that can later be used in other directives along with the
resulting variable.<br><br></div><div style="font-size:small;color:rgb(51,51,153)">Trying to do the following failed validation:<br></div><div style="font-size:small;color:rgb(51,51,153)">map $host $foo {<br></div><div style="font-size:small;color:rgb(51,51,153)">    "~*^www\.(.*)$"    $1; # Positional capture fails<br></div><div style="font-size:small;color:rgb(51,51,153)">    default                    $foo;<br></div><div style="font-size:small;color:rgb(51,51,153)">}<br><br></div><div style="font-size:small;color:rgb(51,51,153)">What am I doing wrong?<br clear="all"></div><div><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div>
</div>
</blockquote></div></div></div></blockquote></div><br></body></html>