ID: 40961
Comment by: smlerman at gmail dot com
Reported By: jfgingras at cegep-ste-foy dot qc dot ca
Status: Open
Bug Type: *Regular Expressions
Operating System: FreeBSD 6.1-RELEASE
PHP Version: 5.2.1
New Comment:
$body = "b2c3d4e5f6a7b8c9e0f1a2b3c4d5e6f7";
$body = preg_replace('/(^[a-f0-9]{32}$)/', '?', $body );
var_dump($body);
string(1) "?"
That's what I get in 5.1.6 on Linux and 5.2.1 on Windows.
Previous Comments:
------------------------------------------------------------------------
[2007-03-30 17:30:43] jfgingras at cegep-ste-foy dot qc dot ca
Description:
------------
I can't use full PCRE in preg_replace and preg_match functions.
If I do:
$body = "b2c3d4e5f6a7b8c9e0f1a2b3c4d5e6f7";
$body = preg_replace('/(^[a-f0-9]{32}$)/', '?', $body );
preg_replace() return en empty string instead of "?" or the original
string if the regex doesn't match as the documentation says.
But, if I use this:
$body = "b2c3d4e5f6a7b8c9e0f1a2b3c4d5e6f7";
$body = preg_replace('^[a-f0-9]{32}$', '?', $body );
It works!!
I got the same problem with preg_match, it always return false.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40961&edit=1