RE: [PHP] regular expression
| From: | Simon Hayward | Date: | Wed, 07 Apr 2004 09:28:30 +0000 |
| Subject: | RE: [PHP] regular expression | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-182603@lists.php.net to get a copy of this message | ||
preg_match("/To: ([^<]+)<?([^>]+)?>?/i",$string,$matches);
returns email in $matches[1] in the first instance
and name in $matches[1] and email in $matches[2] in the second.
-----Original Message-----
From: Robert Kornfeld [mailto:aon.912628966@aon.at]
Sent: 07 April 2004 09:32
To: php-general@lists.php.net
Subject: [PHP] regular expression
hey, professionals out there:
i need to write a parser for an email-header to retrieve the email of the
'To:'-field.
there are 2 possibilities:
'To: foo@foo.com' or
'To: first foo <foo@foo.com>'
i would only need the email-adress!
does anyone know the regular expression that can handle both possibilities?
(i give up!)
thanx!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Legal Disclaimer:-
Internet communications are not secure and therefore the
Barclays Group does not accept legal responsibility for the
contents of this message. Although the Barclays Group
operates anti-virus programmes, it does not accept
responsibility for any damage whatsoever that is caused
by viruses being passed. Any views or opinions presented
are solely those of the author and do not necessarily
represent those of the Barclays Group.
Replies to this e-mail may be monitored by the Barclays
Group for operational or business reasons.
Barclays Bank PLC trading as "Shopsmart from Barclaycard".
Registered Office: 54 Lombard Street
London EC3P 3AH
Registered in England, Registration No. 1026167.