RE: [PHP] preg_replace and emails
| From: | Michael | Date: | Sun, 04 May 2003 19:22:16 +0000 |
| Subject: | RE: [PHP] preg_replace and emails | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146375@lists.php.net to get a copy of this message | ||
Hi David
I have an email tag that looks like this:
[EMAIL=mike@yahoo.com]here's my email[/EMAIL]
which will convert to <a href="mailto:mike@yahoo.com">here's my email</a>
but I also want to convert any emails that aren't tagged so that's why I
want to exclude any emails with mailto: infront of them.
Hopes that makes sense.
BTW what's screen scaping?
-----Original Message-----
From: David Otton [mailto:phpmail@jawbone.freeserve.co.uk]
Sent: May 4, 2003 2:31 PM
To: Michael
Cc: Php-General@Lists.Php.Net
Subject: Re: [PHP] preg_replace and emails
On Sun, 4 May 2003 12:48:16 -0400, you wrote:
>"mike@yahoo.com" converts to "<a
>href="mailto:mike@yahoo.com">mike@yahoo.com</a>"
>
>$text =
>preg_replace("/([\w-?&;#~=\.\/]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-
9
>]{1,3})(\]?))/i","<A HREF=\"æ
>\“©”ŒË ¤ÝHxmailto:$1\">$1</A>", $text);
>
>... but I'm having problems with this:
>
>"<a
>href="mailto:mike@yahoo.com">mike@yahoo.com</a>"
>
>converts to
>
>"<a href="mailto:<a
>href="mailto:mike@yahoo.com">mike@yahoo.com</a>"><a
>href="mailto:mike@yahoo.com">mike@yahoo.com</a></a>"
>
>What do I need to include in the regex to not do it if
>"mailto:" is infront
>of the email address?
I had a reply ready to go, but it occurs to me that someone dealing with
email addresses in the form "<a
href="mailto:mike@yahoo.com">mike@yahoo.com</a>"
/before/ processing, is
screen-scraping them.
Just to set my mind at rest before I post, what exactly are you trying
to do?
---
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.474 / Virus Database: 272 - Release Date: 18/04/03
---
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.474 / Virus Database: 272 - Release Date: 18/04/03