I am using the following to find and replace words within string $content:
$replacedcontent = preg_replace('/\b'.$term_name.'\b/u', '<a class="highlight">'.$term_name.'</a>', $content);
Is there a simple way using regex to only replace words if they are not immediately preceded by an <a href="[link to somewhere]"> tag?