title: How to get regex to match multiple script tags?
body: <p>I'm trying to return the contents of any  tags in a body of text. I'm currently using the following expression, but it only captures the contents of the first  tag and ignores any others after that. </p>
  
  <p>Here's a sample of the html:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
          alert('1');
      &lt;/script&gt;
  
      &lt;div&gt;Test&lt;/div&gt;
  
      &lt;script type="text/javascript"&gt;
          alert('2');
      &lt;/script&gt;
  </code></pre>
  
  <p>My regex looks like this:</p>
  
  <pre><code>//scripttext contains the sample
  re = /&lt;script\b[^&gt;]*&gt;([\s\S]*?)&lt;\/script&gt;/gm;
  var scripts  = re.exec(scripttext);
  </code></pre>
  
  <p>When I run this on IE6, it returns 2 matches. The first containing the full  tag, the 2nd containing alert('1').</p>
  
  <p>When I run it on <a href="http://www.pagecolumn.com/tool/regtest.htm" rel="noreferrer">http://www.pagecolumn.com/tool/regtest.htm</a> it gives me 2 results, each containing the script tags only.</p>