Efficient way to filter this string

From: Date: Thu, 22 Jul 2004 08:18:08 +0000
Subject: Efficient way to filter this string
Groups: php.general 
Request: Send a blank email to php-general+get-191487@lists.php.net to get a copy of this message
Hello, I have an email string that sometimes has a name and the email address between <> and sometimes has the email adress right away. Two examples of the possible value of $address Joe Doe <joe.doe@somedomain.com> jamie.doe@somedomain.com I need to convert this string always to the email address and discard the name to the left of the < character, if the string is already correct (like jamie.doe@somedomain.com) then do not change it, keep it as it is. I have writen a function to do a for loop and check for the < then copy everything to the end removing the >. I wonder, is there a more efficient, clear way to accomplish this? Thanks in advace.

« previous php.general (#191487) next »