#45916 [Fbk->Opn]: PCRE_DOTALL with PCRE_UNGREEDY not skip the end newline character

From: Date: Wed, 27 Aug 2008 00:18:09 +0000
Subject: #45916 [Fbk->Opn]: PCRE_DOTALL with PCRE_UNGREEDY not skip the end newline character
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-128459@lists.php.net to get a copy of this message
 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)

« previous php.bugs (#128459) next »