I've got a string that contains some crappy Microsoft characters. I want to remove all the <a name> tags and just replace them with <i> italics tags around the text inside. However the string contains multiple a name tags as well as <a href tags which I dont' want to be touched.
This is the string:
$b2 = '<A name=OLE_LINK2>test<b>test</b></A><A name=OLE_LINK1>Any member who wishes to obtain a copy of <b><i>Roark v. Commissioner</i></b> may do so through the following means: (1) use hyperlink above next to "Major References,"</A> asfdasfds';
I'm using this preg_replace:
$body = preg_replace('/<a name=OLE_LINK([0-9])>(.*)<\/a>/i', '<i>\2</i>', $b2);
But its only replacing the first a name tag and its not replacing the </a>'s at all.
any help would be greatly appreciated.