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