Extracting email addresses
| From: | jr | Date: | Fri, 01 Nov 2002 21:33:30 +0000 |
| Subject: | Extracting email addresses | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122459@lists.php.net to get a copy of this message | ||
Hello Everyone,
Does anyone have an regular expression or other way to extract an email
address out of a string.
I have been using:
if (ereg ("^" .
"[a-z0-9]+([_\\.-][a-z0-9]+)*" . //user
"@" .
"([a-z0-9]+([\.-][a-z0-9]+)*)+" . //domain
"\\.[a-z]{2,}" . //sld, tld
"$" , $body[$line], $regs))
It will match an email address by itself for example;
jr@johnrudnick.com.
What it won't do is extract jr@johnrudnick.com from; <a
href="mailto:jr@johnrudnick.com">jr@johnrudnick.com</a>.
Any help would be appreciated.
Thanks in Advance!
JR
-----
SallyJo, Inc., offers Top Notch Dedicated & Virtual Hosting.
Visit: http://www.SallyJoInc.com