Here is my string:
$str="<p>Some <a href="#">link</a> with <a href="http://whatever.html?bla">LINK2</a> and <a href="http://whatever.html?bla" target="_blank">LINK3</a> and</p> more html"
I would like to remove the links LINK1 and LINK2 using php to get:
"<p>Some <a href="#">link</a> with and and</p> more html"
Here is what I think is close to what I need:
$find = array("<a(.*)LINK1(.*)</a>", "<a(.*)LINK2(.*)</a>");
$replace = array("", "");
$result=preg_replace("$find","$replace",$str);
This isn't working. I have searched for days and tried many other options but never managed to get this to work as expected. Also, I don't really mind if LINK1 and 2 appear as soon as the a tags are removed.