C.F. Scheidecker Antunes wrote:

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 <[EMAIL PROTECTED]> [EMAIL PROTECTED]

<snip>


Off the top of my head - have you tried using a function like strrpos() to find the last occurence of the > and use this (+ 1) as the start of a substring? This could avoid having to loop throguh he string - e.g

$raw_address =  'Joe Doe <[EMAIL PROTECTED]> [EMAIL PROTECTED]';

$email_address = substr($raw_address, (strrpos($raw_address, '>') + 1));


-- ==================== Rory McKinley Nebula Solutions +27 21 555 3227 - office +27 21 551 0676 - fax +27 82 857 2391 - mobile www.nebula.co.za ====================

This e-mail is intended only for the person to whom it is addressed and
may contain confidential information which may be legally privileged.
Nebula Solutions accepts no liability for any loss, expense or damage
arising from this e-mail and/or any attachments.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to