#45479 [Opn->Csd]: wrong result when using preg_replace with /u and ungreedy *?

From: Date: Tue, 15 Jul 2008 10:13:15 +0000
Subject: #45479 [Opn->Csd]: wrong result when using preg_replace with /u and ungreedy *?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126749@lists.php.net to get a copy of this message
ID: 45479 Updated by: nlopess@php.net Reported By: michael dot virnstein at brodos dot de -Status: Open +Status: Closed Bug Type: PCRE related Operating System: Linux PHP Version: 5.2.6 New Comment: Bug was in PCRE (http://bugs.exim.org/show_bug.cgi?id=732) and not in PHP. Anyway the fix will be bundled with the next PCRE release. Previous Comments: ------------------------------------------------------------------------ [2008-07-10 16:53:13] michael dot virnstein at brodos dot de Description: ------------ When i use preg_replace with the /u utf-8 modifier and an ungreedy search e.g. with *?, the result is different to a call without /u. Reproduce code: --------------- <?php echo "without /u:". preg_replace('/^[^d]*?(d)?$/', '\\1', 'abc'); echo "<br>"; echo "with /u: ".preg_replace('/^[^d]*?(d)?$/u', '\\1', 'abc'); ?> Expected result: ---------------- without /u: with /u: Actual result: -------------- without /u: with /u: abc ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45479&edit=1

« previous php.bugs (#126749) next »