Forum Moderators: coopster

Message Too Old, No Replies

preg * vs ereg *

         

phparion

3:31 pm on Jun 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi,

if you must use a regular expression function, which one is the better between preg_* and ereg_* functions for considering all aspects?

I got divided answers from developers, some say preg and some ereg, I personally favors ereg since preg uses complex pearl style processing. I just want to clear my confusion.

Any wise words are very welcome. thank you

bkeep

3:52 pm on Jun 27, 2009 (gmt 0)

10+ Year Member



You should use the pcre functions from this point forward preg is faster and the posix ereg expressions are being deprecated as of PHP 5.3.0. and completely removed in PHP v6 So start changing your old ereg functions over.

coopster

5:09 pm on Jun 27, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I started noticing speed differences as of PHP5. I discovered that the later versions of the pcre engine were faster than some (most all) of the built-in functions that do similar processing. I have posted some of this analysis/discovery, but you may want to do your own time studies. I was going to search for some of the old comparison links, but as bkeep alluded, you'll want to convert anyway.

No more ereg regular expressions! [webmasterworld.com]
Regular Expression (POSIX Extended) deprecated