#45916 [Opn->Fbk]: PCRE_DOTALL with PCRE_UNGREEDY not skip the end newline character
ID: 45916
Updated by: jani@php.net
Reported By: xxorax at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: PCRE related
Operating System: *
PHP Version: 5.2.6
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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)