Stripe texts out of string
<p>I want to strip the <code>&lt;img&gt;</code> tags and it's contents out of my string that is returned from the database.</p>

<p><strong>Example string</strong></p>

<pre><code>//I want to retrive dummy texts from my string.
var string = "&lt;img src='test.jpg'/&gt;dummy texts &lt;img src='text.jpg'/&gt; dummby text dummy texts";
</code></pre>

<p>I have tried</p>

<pre><code>if (string.indexOf('&lt;img') != -1) {
    var newString = $(string).filter(function() {
        return this.tagName != 'img';
    }).text();
}
</code></pre>

<p>However, my DB has crappy data and sometimes return</p>

<pre><code>//There is no closure for image tag. 
var string = "&lt;img src='test.jpg'/&gt;dummy texts &lt;img src='text.jpg'/&gt; dummby text dummy texts";
</code></pre>

<p>and my code would strip the entire string. </p>

<p>The image tag positions vary.</p>

<p>How do I strip the <code>&lt;img&gt;</code> tags efficiently?</p>
