In the code below I want to replace plain ampersands with "and" while ignoring the ampersands that are being used as part of an html entities (ex: ")
I've tested my expression &(?!([\w ]{2,7}|#[\d]{1,4});) over at http://www.gskinner.com/RegExr/ and it matches what I want.
However, when I run this code, the results are blank.
$content = "" Apples & Oranges "";
$content = preg_replace("/&(?!([\w
]{2,7}|#[\d]{1,4});)/g","and",$content);
echo $content;
Is my approach flawed somehow or do I just have a syntax issue?