Re: preg_replace and emails
| From: | David Otton | Date: | Sun, 04 May 2003 18:31:02 +0000 |
| Subject: | Re: preg_replace and emails | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146373@lists.php.net to get a copy of this message | ||
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=\"mailto:$1\"bª|>�t/põ
>9YG`,>$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?