Edit report at http://bugs.php.net/bug.php?id=53797&edit=1
ID: 53797 Updated by: [email protected] Reported by: lists at excogitate dot co dot uk Summary: PCRE_DOTALL modifier overrides non-greedy operator -Status: Open +Status: Bogus Type: Bug Package: PCRE related Operating System: Windows 7 PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2011-01-20 02:41:09] lists at excogitate dot co dot uk 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 this bug report at http://bugs.php.net/bug.php?id=53797&edit=1
