On Sat, Jun 13, 2009 at 5:16 PM, Al<n...@ridersite.org> wrote:
>
>
> Al wrote:
>>
>> This preg_replace() should simply replace all "&" with "&amp;" unless the
>> value is already "&amp;"
>>
>> 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
>>
>> Al.......
>
> I erred when I keyed this message. The "But,...." should be as, without the
> "e" on quote. Which is an HTML entity for quote.
>
> But; if $value is simple a quote character ["] I get "&quot". e.g.,
>  "test" => &quot;test&quot;
>

The regex that you posted won't replace an actual quote character at
all. Are you sure you aren't running the value through something like
htmlspecialchars() before it's getting into your regexp?

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to