Re: preg_replace and e option (bug or feature?)
| From: | Andrei Zmievski | Date: | Fri, 05 May 2000 14:39:39 +0000 |
| Subject: | Re: preg_replace and e option (bug or feature?) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-18460@lists.php.net to get a copy of this message | ||
On Fri, 05 May 2000, Wico de Leeuw wrote:
> Hiya
>
> Let me explain...
>
> i want to replace everting in a text BETWEEN #! and !# with the equalvalent
> of addslahes to store it in a database so far i can get it with a regual
> (even not with the preg_replace e option)
> the problem is that the text outside teh #! and the !# may not be altered
>
> I thought that asking for that feature to catch machted paterns into a var
> would solve my problem
> and maybe someone else to, can't imagine that i'm the first who is bitten
> by this problem
>
> I can make it work by parsing this text with replace and strpos and stuff
> but that would be slow
>
> And the regular you gave me whould only catch '" (didn't get it to work how
> i wanted) but wouldn't catch the php null code (chr(0)) like addslashes will
preg_replace("/['\"\x00]/", "\\\\0", $html);
-Andrei
Politics is for the moment, an equation is for eternity.
-- Albert Einstein