I'm trying automate internal links within pages on my website. I need already linked text to be exempted.
For the following example it should only replace the bolded text (Example).
<a class="Example" href="http://www.example.com/">Example</a>
<p>New **Example**</p>
I tried the following but it didn't work.
$re = '/(\b'.$search.'\b)+((?=.*<a)|(?!.*<\/a>))/';
$str=preg_replace($re, $replace, $text);