From:             [EMAIL PROTECTED]
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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to