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
https://forums.phpfreaks.com/topic/12040-ereg-vs-preg/
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
https://forums.phpfreaks.com/topic/12040-ereg-vs-preg/#findComment-45969
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
https://forums.phpfreaks.com/topic/12040-ereg-vs-preg/#findComment-630159
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
https://forums.phpfreaks.com/topic/12040-ereg-vs-preg/#findComment-630329
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.