title: How to match the first image element without preceding text?
body: <p>I need to select the the first image tag in a HTML string, but only if it does not have preceding text. So for example, it should match this:</p>
  
  <pre><code>&lt;p&gt;&lt;span&gt;&lt;a href=""&gt;&lt;img src="some.jpg"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
  </code></pre>
  
  <p>But it should not match this:</p>
  
  <pre><code>&lt;p&gt;Text text text&lt;span&gt;&lt;a href=""&gt;&lt;img src="some.jpg"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
  </code></pre>
  
  <p>nor this:</p>
  
  <pre><code>&lt;p&gt;&lt;span&gt;Text text text&lt;a href=""&gt;&lt;img src="some.jpg"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
  </code></pre>
  
  <p>I've tryed something like:</p>
  
  <pre><code>/(&lt;[^&gt;]+&gt;)&lt;img/is
  </code></pre>
  
  <p>So that I can select the tags before the img tag, but I'm not able to exclude the text that can be in any tag preceding the img element.</p>
  
  <p>Some thought?</p>