Jump to content

ereg vs. preg


poirot

Recommended Posts

I've been wondering, between the two sets of functions, which one(s) should I should when coding a script that is intended to be distributed?

PCRE is often considered faster - and better - than the POSIX set, but the Manual says:
"Regular expression support is provided by the PCRE library package..."

This means there are chances of some server don't support them, right? Should I have this in mind and use ereg? To further increase confusion, here is some weird discussion about

"Move ereg to PECL"
[a href=\"http://www.php.net/~derick/meeting-notes.html#move-ereg-to-pecl\" target=\"_blank\"]http://www.php.net/~derick/meeting-notes.h...ve-ereg-to-pecl[/a]

What should I do?
Thanks [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
Share on other sites

This is covered in "Mastering Regular Expressions." In a nutshell, POSIX was an attempt at standardization. One positive is that is uses locales; however, this is alleviated when tools work with Unicode. Then came Perl, and thus PCRE, which really spiffed up regular expressions capabilities.

See [a href=\"http://en.wikipedia.org/wiki/Regular_expressions\" target=\"_blank\"]http://en.wikipedia.org/wiki/Regular_expressions[/a].
Link to comment
Share on other sites

  • 2 years later...
Hello Poirot,
I have always used PCRE and I have never had any problems with support. Also, I just read somewhere, possibly the "Mastering Regular Expressions" Third edition thread, that support for POSIX regular expressions might be dropped from PHP 6.  I think that speaks for itself. Also, if you need to write a script in Perl you will feel at home.
Link to comment
Share on other sites

[quote author=gentooman link=topic=95922.msg979081#msg979081 date=1220157820]
Hello Poirot,
I have always used PCRE and I have never had any problems with support. Also, I just read somewhere, possibly the "Mastering Regular Expressions" Third edition thread, that support for POSIX regular expressions might be dropped from PHP 6.  I think that speaks for itself. Also, if you need to write a script in Perl you will feel at home.
[/quote]

Actually, those talks were finalized.  POSIX is being dropped from PHP6 and will ONLY be available through PECL, while PCRE CANNOT be removed after PHP5.3.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.