title: How to capture multiline regex between two tags?
body: <p>What's the best way to select all text between 2 comment tags? E.g.</p>
  
  <pre><code>&lt;!-- Text 1
       Text 2
       Text 3
  --&gt;
  </code></pre>
  
  <p><code>&lt;\!--.*</code> will capture <code>&lt;!-- Text 1</code> but not <code>Text 2</code>, <code>Text 3</code>, or <code>--&gt;</code></p>
  
  <p><strong>Edit</strong>
  As per Basti M's answer, <code>&lt;\!--((?:.*\n)*)--&gt;</code> will select everything between the <strong>first</strong> <code>&lt;!--</code> and <strong>last</strong> <code>--&gt;</code>. I.e. lines 1 to 11 below.</p>
  
  <p>How would I modify this to select just lines within separate tags? i.e. lines 1 to 4:</p>
  
  <pre><code>1 &lt;!-- Text 1 //First
  2      Text 2
  3      Text 3
  4 --&gt;
  5
  6 More text
  7 
  8 &lt;!-- Text 4
  9      Text 5
  10     Text 6
  11 --&gt;         //Last
  </code></pre>