Bug #13439 Updated: unbound .* patterns don't work properly
| From: | john at scl dot co dot uk | Date: | Fri, 07 Jun 2002 18:48:36 +0000 |
| Subject: | Bug #13439 Updated: unbound .* patterns don't work properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9789@lists.php.net to get a copy of this message | ||
ID: 13439
Updated by: john@scl.co.uk
Reported By: john@scl.co.uk
-Status: Bogus
+Status: Open
Bug Type: Regexps related
PHP Version: 4.0.5
New Comment:
Derick!
This _is_ a bug! I've now upgraded to 4.2.1 and the
behaviour remains the same. Consider just these two:
ereg_replace('.+','b','aa') -> b
ereg_replace('.*','b','aa') -> bb
and this from man 7 regex:
"An atom followed by `*' matches a sequence
of 0 or more matches of the atom. An atom followed
by `+' matches a sequence of 1 or more matches of
the atom."
How can it NOT be a bug?
Previous Comments:
------------------------------------------------------------------------
[2002-06-02 13:58:49] derick@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2001-09-25 14:41:40] john@scl.co.uk
These 2 are OK:
ereg_replace('..','b','aa') -> b
ereg_replace('.+','b','aa') -> b
But this is wrong:
ereg_replace('.*','b','aa') -> bb
You can "fix" it by binding to the beginning:
ereg_replace('^.*','b','aa') -> b
but not by binding to the end:
ereg_replace('.*$','b','aa') -> bb
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=13439&edit=1