Re: Verifying a certain amount of numbers
| From: | Ivo Fokkema | Date: | Wed, 16 Jul 2003 14:27:31 +0000 |
| Subject: | Re: Verifying a certain amount of numbers | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155430@lists.php.net to get a copy of this message | ||
"Curt Zirzow" <curt@zirzow.dyndns.org> wrote in message
news:20030716141706.GR50106@bagend.shire...
> Excellent point! I find my self using regex's a bit to often when there
> are other solutions available.
>
> btw, have you ever tested the difference between
>
> if(ereg('^[0-9]{6}$',$str))
> if(preg_grep('^[0-9]{6}$',$str))
>
> I've been meaning to find out advantages/disadvantages with PERL vs.
> POSIX compatible.
Without getting too far astray from the real subject, I was once writing a
script opening a textfile and modifying the whole contents to create a new
file, using POSIX compatible expressions. My script timed out (30sec+) at
some 400kb. I read Perl compatible was faster, and so I modified my script
to use those. Result : done in a couple of secs.
I bet it depends on the type of expression (these were a bunch of replaces)
but for larger input or many iterations I'd rather use Perl compatible...
--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands