Re: preg_replace problem
| From: | Al | Date: | Sat, 13 Jun 2009 20:21:22 +0000 |
| Subject: | Re: preg_replace problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294023@lists.php.net to get a copy of this message | ||
Shawn McKenzie wrote:
Al wrote:I tried IE8 thinking it could be a weird browser bug. Same error.This preg_replace() should simply replace all "&" with "&" unless the value is already "&" But; if $value is simple a quote character ["] I get ""e". e.g., "test" => "e;test"e; Search string and replace works as it should in Regex_Coach. echo $value.'<br />'; $value=preg_replace("%&(?!amp;)%i", "&", $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.......Your code works for me, unless I'm misunderstanding the problem. With the following: $value = ""e;test"e;"; I get: "e;test"e;<br /> &quote;test&quote;