title: Php lazy regex does not behave lazy
body: <p>There is a url in several pages I need to remove.
  It is implemented in several different ways, like a script source, used in a script as a variable, or a img src in a noscript tag.</p>
  
  <p>I've written the following regex to deal with this:</p>
  
  <pre><code>/&lt;[no]*script[\s\S]+?www.badurl.com[\s\S]+?&lt;\/[no]*script&gt;/i
  </code></pre>
  
  <p>The problem is, that it does not behave lazy all the time.</p>
  
  <p>In the following example it should only select the last script block, but it does select both instead:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var stuff = {"foo":"bar"}foo.c(stuff,1);
  &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  &lt;!--
  var foo="http://www.badurl.com/cgi-bin/;[comment]";
  document.write("&lt;img src=\""+bar+"?r="+escape(document.referrer)+"&amp;d="+(Math.random()*100000)+"\" width=\"1\" height=\"1\" alt=\"foobar\" /&gt;");
  //--&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>Where is my mistake?</p>