title: Regular expression Remove tags around a specific string
body: <p>Here is my string:</p>
  
  <pre><code>$str="&lt;p&gt;Some &lt;a href="#"&gt;link&lt;/a&gt; with &lt;a href="http://whatever.html?bla"&gt;LINK2&lt;/a&gt; and &lt;a href="http://whatever.html?bla" target="_blank"&gt;LINK3&lt;/a&gt; and&lt;/p&gt; more html"
  </code></pre>
  
  <p>I would like to remove the links LINK1 and LINK2 using php to get:</p>
  
  <pre><code>"&lt;p&gt;Some &lt;a href="#"&gt;link&lt;/a&gt; with and and&lt;/p&gt; more html"
  </code></pre>
  
  <p>Here is what I think is close to what I need:</p>
  
  <pre><code>$find = array("&lt;a(.*)LINK1(.*)&lt;/a&gt;", "&lt;a(.*)LINK2(.*)&lt;/a&gt;");
  $replace = array("", "");
  $result=preg_replace("$find","$replace",$str);
  </code></pre>
  
  <p>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.</p>