Re: [PHP] Regex in PHP

2008-06-05 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 lower

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

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

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

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 because they have

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 stripos

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

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 you only

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 two tests for

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 appropriately

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 having a lower and

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 script

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 wrong?

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 be

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 no need

Re: [PHP] Regex in PHP

2008-06-03 Thread Liran Oz
You can use this: $str = '[EMAIL PROTECTED]'; preg_match('/[EMAIL PROTECTED]@(.+)/', $str, $matches); var_dump($matches);//will be in $matches[1] Or without regex: echo substr($str, strpos($str, '@')+1); Liran - Original Message - From: VamVan [EMAIL PROTECTED] To:

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 hotmail.com