From:
Operating system: Windows 7
PHP version: 5.3.5
Package: PCRE related
Bug Type: Bug
Bug description:PCRE_DOTALL modifier overrides non-greedy operator
Description:
------------
If the PCRE_DOTALL 's' modifier is specified in the regex, instances of the
non-greedy (lazy) operator '?' are ignored.
Test script:
---------------
$input = <<<END
<p>paragraph 1</p>
<p>paragraph 2</p>
END;
print "Output 1:\n";
print preg_replace('|<p.*?>paragraph 2</p>|', '', $input);
print "\nOutput 2:\n";
print preg_replace('|<p.*?>paragraph 2</p>|s', '', $input);
Expected result:
----------------
Output 1 and Output 2 should be the same, i.e. with the second paragraph
removed.
Actual result:
--------------
Output 2, with the PCRE_DOTALL modifier set, is blank: the first pattern
matched greedily.
--
Edit bug report at http://bugs.php.net/bug.php?id=53797&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53797&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53797&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53797&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53797&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53797&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53797&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53797&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53797&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53797&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53797&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53797&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53797&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53797&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53797&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53797&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53797&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53797&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53797&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53797&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53797&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53797&r=mysqlcfg