title: Can regex capture and substitution be used with an Apache DirectoryMatch directive?
body: <p>Does anyone know if it's possible to use regex capture within Apache's DirectoryMatch directive? I'd like to do something like the following:</p>
  
  <pre><code>&lt;DirectoryMatch ^/home/www/(.*)&gt;
      AuthType Basic
      AuthName $1
      AuthUserFile /etc/apache2/svn.passwd
      Require group $1 admin
  &lt;/DirectoryMatch&gt;
  </code></pre>
  
  <p>but so far I've had no success.</p>
  
  <p>Specifically, I'm trying to create a group-based HTTP Auth for individual directories/vhosts on a server in Apache 2.0. </p>
  
  <p>For example, Site A, pointing to /home/www/a will be available to all users in group admin and group a, site b at /home/www/b will be available to all users in group admin and group b, etc. I'd like to keep everything based on the directory name so I can easily script adding htpasswd users to the correct groups and automate this as much as possible, but other suggestions for solving the problem are certainly welcome.</p>