title: Can I have a non-greedy regex with dotall?
body: <p>I would like to match dotall and non-greedy. This is what I have:</p>
  
  <pre><code>img(.*?)(onmouseover)+?(.*?)a
  </code></pre>
  
  <p>However, this is not being non-greedy. This data is not matching as I expected:</p>
  
  <pre><code>&lt;img src="icon_siteItem.gif" alt="siteItem" title="A version of this resource is available on siteItem" border="0"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;/td&gt;&lt;td rowspan="4" width="20"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;An activity in which students find other more specific adjectives to 
  describe a range of nouns, followed by writing a postcard to describe a 
  nice holiday without using the word 'nice'.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;From the resource collection: &lt;a href="http://www.siteItem.co.uk/index.asp?CurrMenu=searchresults&amp;amp;tag=326" title="Resources to help work"&gt;Drafting &lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;abbr style="border-bottom:0px" title="Key Stage 3"&gt;thing&lt;/abbr&gt; | &lt;abbr style="border-bottom:0px" title="Key Stage 4"&gt;hello&lt;/abbr&gt; | &lt;abbr style="border-bottom:0px" title="Resources"&gt;Skills&lt;/abbr&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div style="padding-left: 30px"&gt;&lt;div&gt;&lt;table style="" bgcolor="#DFE7EE" border="0" cellpadding="0" cellspacing="5" width="100%"&gt;&lt;tbody&gt;&lt;tr valign="top"&gt;&lt;td rowspan="4" width="60"&gt;&lt;a href="javascript:requiresLevel0(350,350);"&gt;&lt;img name="/attachments/3700.pdf" onmouseover="ChangeImageOnRollover(this,'/application/files/images/attach_icons/rollover_pdf.gif')" onmouseout="ChangeImageOnRollover(this,'/application/files/images/attach_icons/small_pdf.gif')" src="small_pdf.gif" alt="Download Recognising and avoiding ambiguity in PDF format" title="Download in PDF format" style="vertical-align: middle;" border="0"&gt;&lt;/a&gt;&lt;br&gt;790.0 k&lt;br&gt;
  </code></pre>
  
  <p>and I cannot understand why.</p>
  
  <p>What I think I am stating in the above regex is:</p>
  
  <blockquote>
    <p>start with "img", then allow 0 or more any character including new line, then look for at least 1 "onmouseover", then allow 0 or more any character including new line, then an "a"</p>
  </blockquote>
  
  <p>Why doesn't this work as I expected?</p>
  
  <p>KEY POINT: dotall must be enabled</p>