Re: [PHP] Regex in PHP

2008-06-05 Thread Richard Heyes
> sorry to bother you richard. You didn't, I just wanted to make sure I wasn't losing it (more). -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP G

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Thu, 2008-06-05 at 00:24 -0400, Nathan Nobbe wrote: > > you really know how to rub it in there rob. but i was looking at the > implementation in the php code, looks like somebody likes my idea > (this code > found in ext/standard/string.c). on the second line the haystack is > converted to low

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 11:43 PM, Robert Cummings <[EMAIL PROTECTED]> wrote: > On Wed, 2008-06-04 at 23:20 -0400, Nathan Nobbe wrote: > > > > i repeated your test using the time program and splitting the script into > 2, > > one for each strpos and stripos, to find similar results. imo, there is >

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 23:20 -0400, Nathan Nobbe wrote: > > i repeated your test using the time program and splitting the script into 2, > one for each strpos and stripos, to find similar results. imo, there is no > need for 2 comparisons for case-insensitive searches, because both arguments > can

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 2:06 PM, Robert Cummings <[EMAIL PROTECTED]> wrote: > On Wed, 2008-06-04 at 11:18 -0600, Nathan Nobbe wrote: > > On Wed, Jun 4, 2008 at 11:12 AM, Robert Cummings <[EMAIL PROTECTED]> > > wrote: > > > > > Did you just try to use a test that used a single iteration to prove me

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 11:18 -0600, Nathan Nobbe wrote: > On Wed, Jun 4, 2008 at 11:12 AM, Robert Cummings <[EMAIL PROTECTED]> > wrote: > > > Did you just try to use a test that used a single iteration to prove me > > wrong? OMFG ponies!!! Loop each one of those 10 million times, use a > > separate

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 13:12 -0400, Robert Cummings wrote: > On Wed, 2008-06-04 at 10:56 -0600, Nathan Nobbe wrote: > > On Wed, Jun 4, 2008 at 10:26 AM, Robert Cummings <[EMAIL PROTECTED]> > > wrote: > > > > > Nope, case insensitive is slower since you must make two tests for > > > characters havin

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 11:12 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: > Did you just try to use a test that used a single iteration to prove me > wrong? OMFG ponies!!! Loop each one of those 10 million times, use a > separate script for each, and use the system time program to > appropriatel

Re: [PHP] Regex in PHP

2008-06-04 Thread Nitsan Bin-Nun
at least he have some humer ;-) On 04/06/2008, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Wed, 2008-06-04 at 10:56 -0600, Nathan Nobbe wrote: > > On Wed, Jun 4, 2008 at 10:26 AM, Robert Cummings <[EMAIL PROTECTED]> > > wrote: > > > > > Nope, case insensitive is slower since you must make tw

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 10:56 -0600, Nathan Nobbe wrote: > On Wed, Jun 4, 2008 at 10:26 AM, Robert Cummings <[EMAIL PROTECTED]> > wrote: > > > Nope, case insensitive is slower since you must make two tests for > > characters having a lower and upper case version. With case sensitive > > comparisons

Re: [PHP] Regex in PHP

2008-06-04 Thread Nitsan Bin-Nun
I can't find any good reason for regex in this case. you can try to split it with explode / stristr / create a function by your own which goes over the string and check when a @ is catched, something like: function GetDomainName ($a) { $returnDomain = ""; $beigale = false; for ($i = 0; $i < strl

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 10:26 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: > Nope, case insensitive is slower since you must make two tests for > characters having a lower and upper case version. With case sensitive > comparisons you only need to make a single comparison. a quick test shows str

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 10:18 -0600, Nathan Nobbe wrote: > On Wed, Jun 4, 2008 at 10:10 AM, Richard Heyes <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > and the case insensitive versions are a hair faster still ;) > >> > > > > Are they? I always thought that case-sensitive functions were faster > > b

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 10:10 AM, Richard Heyes <[EMAIL PROTECTED]> wrote: > Hi, > > and the case insensitive versions are a hair faster still ;) >> > > Are they? I always thought that case-sensitive functions were faster > because they have to test fewer comparisons. Eg To test if i == I in a > c

Re: [PHP] Regex in PHP

2008-06-04 Thread Richard Heyes
Hi, and the case insensitive versions are a hair faster still ;) Are they? I always thought that case-sensitive functions were faster because they have to test fewer comparisons. Eg To test if i == I in a case-insensitive fashion requires two comparisons (i == I and i == i) whereas a case-s

Re: [PHP] Regex in PHP

2008-06-03 Thread Nathan Nobbe
On Tue, Jun 3, 2008 at 8:39 PM, VamVan <[EMAIL PROTECTED]> wrote: > Hello All, > > For example I have these email addressess - > > [EMAIL PROTECTED] > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > What would be my PHP function[Regular expression[ to that can give me some > thing like > > yahoo.com > h

Re: [PHP] Regex in PHP

2008-06-03 Thread Liran Oz
Van" <[EMAIL PROTECTED]> To: Sent: Wednesday, June 04, 2008 3:39 AM Subject: [PHP] Regex in PHP Hello All, For example I have these email addressess - [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] What would be my PHP function[Regular expression[ to that can give me so

[PHP] Regex in PHP

2008-06-03 Thread VamVan
Hello All, For example I have these email addressess - [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] What would be my PHP function[Regular expression[ to that can give me some thing like yahoo.com hotmail.com gmail.com Thanks