Re: Efficient way to filter this string
| From: | Rory McKinley | Date: | Thu, 22 Jul 2004 08:53:20 +0000 |
| Subject: | Re: Efficient way to filter this string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191489@lists.php.net to get a copy of this message | ||
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 <joe.doe@somedomain.com> jamie.doe@somedomain.com <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 <joe.doe@somedomain.com> jamie.doe@somedomain.com'; $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.