Well you need to search for "@"

then search forwards and backwards till you get to whitespaces

store those positions

then use the substr function.

- seb

-----Original Message-----
From: Gaylen Fraley [mailto:[EMAIL PROTECTED]]
Sent: 19 August 2001 03:37
To: [EMAIL PROTECTED]
Subject: [PHP] Extract email address from string


I need to parse a string and extract only the email address.  What is the
best way to do this?

i.e.

$string = "Please send all email to [EMAIL PROTECTED] with a subject
line of Test.";

$email_addr would be equal to [EMAIL PROTECTED] .

Thanks.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to