title: How can I write a regex which matches non greedy?
body: <p>I need help about regular expression matching with non-greedy option.</p>
  
  <p>The match pattern is:</p>
  
  <pre><code>&lt;img\s.*&gt;
  </code></pre>
  
  <p>The text to match is:</p>
  
  <pre><code>&lt;html&gt;
  &lt;img src="test"&gt;
  abc
  &lt;img
    src="a" src='a' a=b&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I test on <a href="http://regexpal.com" rel="noreferrer">http://regexpal.com</a></p>
  
  <p>This expression matches all text from <code>&lt;img</code> to last <code>&gt;</code>. I need it to match with the first encountered <code>&gt;</code> after the initial <code>&lt;img</code>, so here I'd need to get two matches instead of the one that I get.</p>
  
  <p>I tried all combinations of <em>non-greedy <code>?</code></em>, with no success.</p>