extracting email adress (NOT validation)

From: Date: Tue, 08 Apr 2003 00:05:30 +0000
Subject: extracting email adress (NOT validation)
Groups: php.general 
Request: Send a blank email to php-general+get-142771@lists.php.net to get a copy of this message
All, I need to extract a 'proper' email from a MySQL field that can contain unfortunatly much more than just the email address. Here is the data as it comes : -- john smith <john@domain.com> "John Smith" <john.smith@domain.com> john@domain.com john henry smith <john@domain.com> john.h.smith@domain.com -- and all I need is just the plain "whatever@domain.com" address. I tried using the following, which sort of works, but is far from ideal (it just catches the 2 signs left of the "@"): preg_match("/^(.*)?([_\\.0-9a-z-]{2}@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,3})(.*)?$/", $mail_from, $plainemail); Is there a way to better the catch, to move left up to the limit of the email address ? Thanks for any hints. j. -- this mail was scanned for viruses aaton.com

« previous php.general (#142771) next »