title: Ant replaceregexp task - Match and replace HTML comments block
body: <p>I have the following block that starts and ends with HTML comments:</p>
  
  <pre><code>    &lt;!--source scripts--&gt;
      &lt;script type="text/javascript" src="/assets/js/namespaces.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/assets/js/main.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/assets/js/header.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/assets/js/headerPremiumForm.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/assets/js/bootstrap.js"&gt;&lt;/script&gt;
      &lt;!--end source scripts--&gt;
  </code></pre>
  
  <p>I created an ant task that finds everything between the <code>&lt;!--source scripts--&gt;&lt;!--end source scripts--&gt;</code> and replaces it with a new script file (in this case min.js), but I have trouble making it work.</p>
  
  <p>This is what I've done so far:</p>
  
  <pre><code>&lt;target name="update-source-with-new-compiled-files"&gt;
      &lt;replaceregexp match="\&amp;lt;!--source scripts--\&amp;gt;(.*?)\&amp;lt;!--end source scripts--\&amp;gt;" replace="\&amp;lt;script src='min.js'\&amp;gt;\&amp;lt;/script\&amp;gt;" flags="g"&gt;
          &lt;fileset dir="${basedir}/../dist" includes="*"/&gt;
      &lt;/replaceregexp&gt;
  &lt;/target&gt;
  </code></pre>