I can't tell you guys how many hours I've spent on this one. I simply want to IGNORE any instances of keywords that are BETWEEN the strong tags. Whether they are directly next to the tags or somewhere in between with other words. All while keeping the keywords case-insensitive.
Example:
The man drove in his car. Then <strong>the man walked to the boat.</strong>
The word boat
should be ignored and Car
should be replaced.
$keywords = array(
'boat',
'car',
);
$p = implode('|', array_map('preg_quote', $keywords));
$string = preg_replace("/\b($p)\b/i", 'gokart', $string, 4);