Bug #14893: RE starting with (.*) might break

From: Date: Sun, 06 Jan 2002 22:57:14 +0000
Subject: Bug #14893: RE starting with (.*) might break
Groups: php.dev 
Request: Send a blank email to php-dev+get-76097@lists.php.net to get a copy of this message
From: japhy@pobox.com Operating system: SunOS PHP version: 4.1.1 PHP Bug Type: PCRE related Bug description: RE starting with (.*) might break Here's the problem: <? echo preg_match('/(.*)\d+\1/', 'ab1b'); ?> It fails, but it really shouldn't. You can fool the engine into not having the bug: <? echo preg_match('/(?=)(.*)\d+\1/', 'ab1b'); ?> The bug is thus: a regex that starts with .* can logically be made to start with an implicit anchor to the beginning of the string. However, this optimization can break the success of a regex if the .* is captured (as above) and used later (the back-reference \1). I've contacted the author of the PCRE package. -- Edit bug report at: http://bugs.php.net/?id=14893&edit=1

« previous php.dev (#76097) next »