RE: [PHP] Regex help
| From: | Lizet Pena de Sola | Date: | Thu, 04 Aug 2005 06:36:49 +0000 |
| Subject: | RE: [PHP] Regex help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219976@lists.php.net to get a copy of this message | ||
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@greenapple.edu> 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@synchromedia.co.uk]
Sent: Wednesday, August 03, 2005 8:57 AM
To: PHP General
Subject: Re: [PHP] 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@synchromedia.co.uk | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php