RE: Regex help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, it's not the regexp for detecting email addresses what I need,
that's widely published, thanks. I'm using ereg to match this regular
expression:

(On)[\s\w\d\W\S\D\n]*(wr[i|o]te[s]?:)

That will match phrases like
"On 8/3/05, Carol Swinehart <cshart@xxxxxxxxxxxxxx> wrote:"
the type "On date, name <email> wrote or writes:"

The thing is I tried this regexp with Regex Coach and it matches fine,
but ereg returns no match

ereg($regexpstr, $str, $regs)

I know there are some comments at php.net about how ereg has some bugs,
any idea if this could be one?

Tia, 
Lizet
-----Original Message-----
From: Marcus Bointon [mailto:marcus@xxxxxxxxxxxxxxxxxx] 
Sent: Wednesday, August 03, 2005 8:57 AM
To: PHP General
Subject: Re:  Regex help

On 2 Aug 2005, at 15:12, Robin Vickery wrote:

> I don't suppose this is the place for a rant about the futility of
> checking email addresses with a regexp?

Though I will agree with you to some extent, I've had quite a lot of  
success with this, which is pretty thorough:

^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\- 
\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61} 
[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)| 
(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4] 
\d|25[0-5])\]))$

Which I got from here:

http://www.hexillion.com/samples/#Regex

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@xxxxxxxxxxxxxxxxxx | http://www.synchromedia.co.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux