#30468 [Opn->Fbk]: preg_replace mistake
| From: | derick@php.net | Date: | Mon, 18 Oct 2004 08:00:00 +0000 |
| Subject: | #30468 [Opn->Fbk]: preg_replace mistake | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67716@lists.php.net to get a copy of this message | ||
ID: 30468
Updated by: derick@php.net
Reported By: fn at fkn-systems dot de
-Status: Open
+Status: Feedback
Bug Type: Regexps related
Operating System: Linux
PHP Version: Irrelevant
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2004-10-18 09:56:17] fn at fkn-systems dot de
Description:
------------
In:
PHP 4.3.4 (cli) (built: Sep 24 2004 13:01:46)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
(also in PHP4.1.2 and PHP-CGI)
followed code (whitout newlines!)
$dat='2004-10-17/15:45.15';
echo'_'.preg_replace('/([.^\x5b]*?)(\x5b\x5b.*?\x5d\x5d)(.*)/s','\\1'."$dat".'\\3','#
foo 1bar [changed: [[tic:tac]]] foo 2bar #').'_';
gives me
_# foo 1bar [changed: 004-10-17/15:45.15] foo 2bar #_
and not
_# foo 1bar [changed: 2004-10-17/15:45.15] foo 2bar #_
Reproduce code:
---------------
<?php
$dat='2004-10-17/15:45.15';
// (whitout newlines!)
echo'_'.preg_replace('/([.^\x5b]*?)(\x5b\x5b.*?\x5d\x5d)(.*)/s','\\1'."$dat".'\\3','#
foo 1bar [changed: [[tic:tac]]] foo 2bar #').'_';
?>
Expected result:
----------------
_# foo 1bar [changed: 2004-10-17/15:45.15] foo 2bar #_
Actual result:
--------------
_# foo 1bar [changed: 004-10-17/15:45.15] foo 2bar #_
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30468&edit=1