Re: url to link
| From: | bill | Date: | Sat, 28 Jul 2001 16:18:46 +0000 |
| Subject: | Re: url to link | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60059@lists.php.net to get a copy of this message | ||
Bill wrote:
> I thought my regexps were up to snuff until they processed this url:
>
>
> http://www.symantec.com/avcenter/venc/data/w32.sircam.worm@mm.html
>
> Anybody have a regexp that can parse for both http & mailto links and
> turn that into an http link -without- turning it also into a mailto
> link?
Thought you might like to see what I'm using now. The below doesn't work
for the above url.
//turn urls into links
$text = eregi_replace("(http://[^ ]*)","<a
href=\"\\1\">\\1</a>",$text);
//turn e-mail into mailto links
$text = eregi_replace("([
]+)([[:alnum:]\.\-]+\@[[:alnum:]\-]+\.[\.[:alnum:]]+)([^\.[:alnum:]])","\\1<a
href=\"mailto:\\2\">\\2</A>\\3", $text);
I'm open to ideas.
kind regards,
bill