title: Matching regexp in SetEnvIf apache
body: <p>I have googled a lot, tried different approaches, but failed. 
  Please help.</p>
  
  <p>What do I want to do:</p>
  
  <p>Replace <code>Content-Disposition</code> header with value, supplied with a link.</p>
  
  <p>Link:
  <a href="http://x.x.x.x/download/d62519317661352416033f343ff871ff253caaf0/58920d09/7571578192jsdgsdg?as=transfer.avi" rel="nofollow noreferrer">http://x.x.x.x/download/d62519317661352416033f343ff871ff253caaf0/58920d09/7571578192jsdgsdg?as=transfer.avi</a></p>
  
  <p>Part of my apache config file which deals with the header:</p>
  
  <pre><code>&lt;Location /download/&gt;
  SetEnvIf Request_URI "^.*\?as\=(.*)\??.*$" FILENAME=$1
  Header unset "Content-Disposition"
  Header add "Content-Disposition" "attachment; filename=\"%{FILENAME}e\""
  </code></pre>
  
  <p>However, it seems that regex did not match and I receive (null) in the filename:</p>
  
  <pre><code>Content-Disposition: attachment; filename="(null)"
  </code></pre>
  
  <p>The interesting thing is that online regex matching tools show that expression is right. Also <code>$1</code> should match to Group1 match. 
  <a href="https://i.stack.imgur.com/mgQ3v.jpg" rel="nofollow noreferrer">regexptool</a></p>