This preg_replace() should simply replace all "&" with "&" unless the value is already "&"

But; if $value is simple a quote character ["] I get "&quote". e.g., "test" => &quote;test&quote;

Search string and replace works as it should in Regex_Coach.

echo $value.'<br />';
$value=preg_replace("%&(?!amp;)%i", "&amp;", $value);
echo $value;

I tried using \x26 for the "&" in the search string; didn't help.

This seems too obvious to be a bug. Using php5.2.9


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to