<div dir="ltr"><div>Fantastic Igor - I didn't know that you could do named captures in Nginx - good to know. </div><div><br></div><div>That solves it rather nicely.</div><div><br></div><div>And thanks B.R. - yep, that syntax is part of PCRE.</div>
<div><br></div><div><br></div><div> Pete</div><div><br></div><div><br></div><div><br></div><div>> I think Igor is suggesting PERL named captures.</div><div>> </div><div>> Although, it appears to me the correct syntax would rather be (?<name>...),</div>
<div>> as perlre docs <<a href="http://perldoc.perl.org/perlre.html#Extended-Patterns">http://perldoc.perl.org/perlre.html#Extended-Patterns</a>>state.</div><div>> Then, just use you first syntax (omitting the 'set' directives).</div>
<div>> ---</div><div>> *B. R.*</div><div>> </div><div>> </div><div>> On Wed, May 28, 2014 at 12:02 PM, Igor Sysoev <igor at <a href="http://sysoev.ru">sysoev.ru</a>> wrote:</div><div>> </div><div>> > On 28 May 2014, at 08:55, Peter Mescalchin <peter.mescalchin at <a href="http://gmail.com">gmail.com</a>></div>
<div>> > wrote:</div><div>> ></div><div>> > Thanks Igor,</div><div>> ></div><div>> > I had explored that method already, sadly (as you know) "alias" is</div><div>> > given as an absolute path meaning I can't use this block of config within</div>
<div>> > multiple virtual hosts which I include; - would have to re-write this same</div><div>> > block of config for each Virtual host modifying the alias path prefix.</div><div>> ></div><div>> > And since alias man page explicitly states that $document_root can't be</div>
<div>> > used it's not possible to complete this config in a reusable way. (e.g.</div><div>> > alias $document_root/path/to/$1/$2; would be perfect).</div><div>> ></div><div>> > Alas, I think what I have (storing the captures in temp vars) is the only</div>
<div>> > real solution thus far.</div><div>> ></div><div>> > Unless the penny hasn't dropped in my head? :)</div><div>> ></div><div>> ></div><div>> > Then you can set these variable directly in regex:</div>
<div>> > location ~ "^/[a-f0-9]{16}/(<?resource_type>css|js)/(<?resource_path>.+)” {</div><div>> ></div><div>> ></div><div>> > --</div><div>> > Igor Sysoev</div><div>> > <a href="http://nginx.com">http://nginx.com</a></div>
</div>