Simple Machines Community Forum

General Community => Scripting Help => Topic started by: Metho on August 04, 2003, 04:02:32 AM

Title: regex question
Post by: Metho on August 04, 2003, 04:02:32 AM
Just because I'm curious now, in what kind of situation would preg_replace be slower than ereg_replace, if ever?

Methonis
Title: Re:regex question
Post by: Zef Hemel on August 04, 2003, 04:40:52 AM
I think preg is always faster, but I never really tested.
Title: Re:regex question
Post by: Metho on August 04, 2003, 04:54:30 AM
Hmm, okies. Just wondering because on php.net in the ereg_replace() help it says that OFTEN preg_replace() was faster, so I was just curious if there were actually any times when it wouldn't be. (As I see preg_replace 99.99% of the time, and every once in a while will see ereg_replace)

Thanks,

Methonis
Title: Re:regex question
Post by: [Unknown] on August 04, 2003, 05:08:47 AM
Ereg syntax can be clearer, but the engine behind it is less optimized and slower so it is almost always worse.

-[Unknown]
Title: Re:regex question
Post by: Metho on August 04, 2003, 05:11:21 AM
Got it, thanks. ;)

Methonis
Title: Re:regex question
Post by: Iridium on August 04, 2003, 06:01:13 PM
Seeing as ereg_* functions are "Extended POSIX syntax" and preg_* are "Perl syntax" I imagine that it's possible for there to be certain things that can be done using ereg_* that can't be done directly with preg_* and in those cases, ereg_* may be faster.