#45916 [Fbk->Opn]: PCRE_DOTALL with PCRE_UNGREEDY not skip the end newline character
ID: 45916
User updated by: xxorax at gmail dot com
Reported By: xxorax at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: PCRE related
-Operating System: *
+Operating System: win32
PHP Version: 5.2.6
New Comment:
this is same result...
Previous Comments:
------------------------------------------------------------------------
[2008-08-26 22:14:09] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
------------------------------------------------------------------------
[2008-08-26 02:56:56] xxorax at gmail dot com
Description:
------------
strange bug, this code skip all characters expect the end \n (\r is
find).
This is the same when .*? is in subpattern.
Reproduce code:
---------------
$str = "test\ntest\r\n";
function v($s) {
echo '"'.$s.'"'."\n---\n";
}
echo v(preg_replace('#^.*$#s','', $str));
echo v(preg_replace('#^.*?$#s','', $str));
echo v(preg_replace('#^.*$#Us','', $str));
Expected result:
----------------
""
---
""
---
""
---
Actual result:
--------------
""
---
"
"
---
"
"
---
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45916&edit=1
Thread (5 messages)