I am aware that regex is not ideal for use with HTML strings and I have looked at the PHP Simple HTML DOM Parser but still believe this is the way to go. All the HTML tags w
Improvisation. It should link only if it is a whole word "Amazon" and not words like AmazonWorld.
$result = preg_replace('%\bAmazon(?![^<]*)\b%i', 'Amazon', $subject);