[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]
RE: [PHP] Extract email address from string
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]
Re: [PHP] Extract email address from string
Seb, Seomthing like ?PHP $string = Please send all email to [EMAIL PROTECTED] with a; ereg('.* (.*@[^ ]* )',$string,$m); echo $m[1] . \n Might be a start. Andy On Sun, Aug 19, 2001 at 03:44:35AM +0100, Seb Frost wrote: 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] -- -- Andrew Libby Director of Technology CommNav, Inc [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]