#20206 [Opn->Bgs]: escape the escape char in preg_replace
| From: | moriyoshi@php.net | Date: | Fri, 01 Nov 2002 09:36:26 +0000 |
| Subject: | #20206 [Opn->Bgs]: escape the escape char in preg_replace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-23884@lists.php.net to get a copy of this message | ||
ID: 20206
Updated by: moriyoshi@php.net
Reported By: tea@softhome.net
-Status: Open
+Status: Bogus
Bug Type: *Regular Expressions
Operating System: win2k sp3
PHP Version: 4.2.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Check your regex pattern again. Two leading backslashes will escape
"*".
Previous Comments:
------------------------------------------------------------------------
[2002-11-01 01:46:39] tea@softhome.net
line 3 also....
missed a '/' :(
$_SESSION["l"] = 'c/c++';
$_SESSION["l"] =
preg_replace("/\\*\//","\/",$_SESSION["l"]);
$_SESSION["l"] =
preg_replace("/\\*\+/","\+",$_SESSION["l"]);
------------------------------------------------------------------------
[2002-11-01 01:43:41] tea@softhome.net
sorry, a typo in the second line of code
$_SESSION["l"] =
preg_replace("/\\*\//","\/",$_SESSION["l"]);
i missed a '/'.
------------------------------------------------------------------------
[2002-10-31 21:38:57] tea@softhome.net
let say:
$_SESSION["l"] = 'c/c++';
$_SESSION["l"] = preg_replace("/\\*\/","\/",$_SESSION["l"]);
$_SESSION["l"] = preg_replace("/\\*\+","\+",$_SESSION["l"]);
what i expect is no matter how the user reload the page
$_SESSION["l"] should be 'c\/c\+\+'
i used the reg exp in perl and tried it out, seems logically correct,
but it cause an error in my php page.
thx for your attention
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20206&edit=1