Hi I'm trying to use preg_replace and I'm a little unclear about it - I'm a bit confused by how it works!
I have a string with HTML in it. What I want to do is strip the image tags from the sting that have a link around them.
E.g. the string is:
<a href="http://www.link.com/" target="_blank"><img src="picture.gif" alt="BLahdy blah" width="300" height="340" border="0"></a>
<img src="picture.gif" alt="BLahdy blah2" width="300" height="340" border="0">
And I want it to output like this:
<a href="http://www.link.com/" target="_blank">BLahdy blah</a>
You'll see that I'm trying to keep the alt tags, and I don't want image tags that don't have a link around them.
Help would be greatly appreciated!