phpregexposixeregposix-ere

The point of PHP's recent dropping of [[:POSIX:]] regular expression flavor


Dropping of the ereg-functions and their POSIX-regular expression flavor in later PHP versions?

After reading the older posting "PHP ereg vs. preg" (Sep '09) concerned of this - and reading the official PHP statement I'm inclined to ask what this is about. Following the development of PHP over the years (and doing much development in Perl and PHP) I'm really unsure if this might be not a bad drift eventually.

I'd assume there would be some members of the PHP development team here on SO, therefore they'd able to help getting some more insight into this.

Are there planned enhancements (future) to complete the preg-functions with the [[:POSIX:]] style? Or will the latter be gone forever? What's the rationale behind either decision?


Solution

  • You can check the last comment before the last here: http://bugs.php.net/49594

    [2009-10-01 20:03 UTC] rasmus@php.net We did not write the regex implementation. We rely on 3rd-party libraries for everything in PHP. If a POSIX-compatible library that supports Unicode magically appears, we can consider it, but as of right now that does not exist and we are not going to write one. I doubt any of the other scripting languages are going to do that either. Python and Ruby both rely on PCRE as well, so we all support the same type of regular expressions.

    The responsible thing for us to do, given the state of regex libraries, is to let users know that Unicode is the future and their current POSIX regular expressions is not going to work in this Unicode world and they need to plan for that.

    I am sorry you do not agree with that, but that is the state of things currently.

    Also other comments on the thread suggest that PCRE is faster, more consistent in syntax and is used in other languages such as Ruby or Python too.