Re: [PHP-DEV] preg_replace and e option (bug or feature?) From: Andrei Zmievski (andrei <email protected>)
Date: 05/05/00

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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>