title: Removing urls with preg_replace
body: <p>I want to remove hyperlinks in php </p>
  
  <p>Here is the html </p>
  
  <pre><code>&lt;a rel="nofollow" href="http://www.clickansave.net/download/somethingelse" title="Download Now" target="_blank"&gt;&lt;img src="http://banners.coolmirage.com/download_bt3.png" border="0" alt="Download"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>I want to remove everything shown above if <code>clickansave.net</code> is found in <code>href</code>.I need a solution that use preg_replace and not dom for the following reason :</p>
  
  <p>I know the <strong>exact</strong> structure of the html to be deleted and there is only one occurrence on page. Dom would be overkill in this case</p>
  
  <p>I tried the following </p>
  
  <p>First i started by removing the </p>
  
  <pre><code>$input = preg_replace('#&lt;img src="http://banners.coolmirage.com/download_bt3.png" border="0" alt="Download"&gt;&lt;\/a&gt;#s', '' , $input,1);
  </code></pre>
  
  <p>From there i thought of this regex which is of course not not working</p>
  
  <pre><code>$input = preg_replace('#&lt;a.*?&lt;img src="http://banners.coolmirage.com/download_bt3.png" border="0" alt="Download"&gt;&lt;\/a&gt;#s', '' , $input,1);
  </code></pre>