Re: Extract email address from string
| From: | Andrew Libby | Date: | Sun, 19 Aug 2001 02:45:02 +0000 |
| Subject: | Re: Extract email address from string | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63316@lists.php.net to get a copy of this message | ||
Seb,
Seomthing like
<?PHP
$string = "Please send all email to someone@somewhere.com 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:gfraley5@earthlink.net]
> Sent: 19 August 2001 03:37
> To: php-general@lists.php.net
> 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 someone@somewhere.com with a subject
> line of Test.";
>
> $email_addr would be equal to someone@somewhere.com .
>
> Thanks.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
--------------------------------------------------
Andrew Libby
Director of Technology
CommNav, Inc
alibby@commnav.com