PHP 4.0 Bug #10038: preg_replace("/([_%&])/","\\\\1",$text) does not work as expected
| From: | reeg-pb at junetz dot de | Date: | Wed, 28 Mar 2001 17:14:47 +0000 |
| Subject: | PHP 4.0 Bug #10038: preg_replace("/([_%&])/","\\\\1",$text) does not work as expected | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-50151@lists.php.net to get a copy of this message | ||
From: reeg-pb@junetz.de
Operating system: Linux (Debian)
PHP version: 4.0.4pl1
PHP Bug Type: PCRE related
Bug description: preg_replace("/([_%&])/","\\\\1",$text) does not work as
expected
Hello,
I want to replace _ with \_, % with \% and & with \&.
Under PHP4.0.3pl1 (tested) and lower the following Code worked as expected:
<?php
$text = "Test with_ and %";
$text = preg_replace("/([_%&])/","\\\\1",$text);
echo $text;
?>
But under PHP4.0.4pl1 the output is:
Test with\\1 and \\1
PHP is compiled as Module with Apache.
Thank you,
Christoph
--
Edit Bug report at: http://bugs.php.net/?id=10038&edit=1