Jump to content

Archived

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

poirot

ereg vs. preg

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\" /]

Share this post


Link to post
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].

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
How does a thread that is two years old get revived? lol

Share this post


Link to post
Share on other sites
[quote author=nrg_alpha link=topic=95922.msg979263#msg979263 date=1220189637]
How does a thread that is two years old get revived? lol
[/quote]

LOL I didn't even notice that, I just posted because I saw it at the top of the board.  Ahahaha.

Share this post


Link to post
Share on other sites

×

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.