Re: [PATCH] ereg to pcre conversion
| From: | Moriyoshi Koizumi | Date: | Thu, 31 Oct 2002 20:04:52 +0000 |
| Subject: | Re: [PATCH] ereg to pcre conversion | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-90394@lists.php.net to get a copy of this message | ||
Just FYI: Recently I found that the result of following code differs by
ereg_replace() and preg_replace().
<?php
$str = "abcde";
var_dump(ereg_replace("", "a", $str));
var_dump(preg_replace("//", "a", $str));
?>
Hmm... there might be other trivial BC problems apart from regex spec
differences, however the ereg_replace() behaviour appears somewhat strange
to me.
Moriyoshi
"Ilia A." <ilia@prohost.org> wrote:
> Currently PHP ships with two regular expression libraries that are both
> installed by default, PCRE & regex. The regex library that is responsible for
> ereg_* functions is fairly old and offers a very limited functionality
> compared to the PCRE library. In most cases the PCRE functions are also much
> faster then the old ereg functions.
> I would like to propose that we drop the old ereg library and use only
> a single regular expression library, PCRE. For BC purposes I've written a
> patch (see attached file), which emulates the old ereg_* functions for people
> who still rely on those, using PCRE.
>
> This cleanup would mean we'd only need to maintain one set of regular
> expression code, which as far as code goes is pretty complex as well as give
> speed-up for people still using ereg.
> Perhaps, at some future point this would allow us to drop the ereg_* functions
> all together.
>
> Ilia