title: Nginx - regex location
body: <p>So I have a regex-based location rule, something like this:</p>
  
  <pre><code>location ~ /(abc.*xyz|def.*zxy|ghk.*qwe)/
  </code></pre>
  
  <p>Can I check which part of regex yielded the match?
  Meaning that if the url was like </p>
  
  <pre><code>/12abc34/
  </code></pre>
  
  <p>Than I'd like to know that it was matched by</p>
  
  <pre><code>.*abc.*
  </code></pre>
  
  <p>Is there a way?</p>
  
  <p>I'm running latest nginx compiled with lua-module on a Debian VM on AWS.</p>
  
  <p>------------Update-------------</p>
  
  <p>I'm thinking to use inner location, but it will be ugly:</p>
  
  <pre><code> location ~ /(abc.*xyz|def.*zxy|ghk.*qwe)/
  {
      location ~ /(abc.*xyz){...}
      location ~ /(def.*zxy){...}
  ...
  }
  </code></pre>
  
  <p>Right now I have like 60 regex patterns. Is such approach ok?</p>