title: Remove everything except image tag from string using regular expression
body: <p>I have string that contains all the html elements , i have to remove everything except images . </p>
  
  <p>Currently i am using this code </p>
  
  <pre><code>$e-&gt;outertext = "&lt;p class='images'&gt;".str_replace(' ', ' ', str_replace('Â','',preg_replace('/#.*?(&lt;img.+?&gt;).*?#is', '',$e)))."&lt;/p&gt;";
  </code></pre>
  
  <p>Its serving my purpose but very slow in execution . Any other way to do the same would be appreciable .   </p>