milov.nl

Interaction design • webdevelopment • web art • photography

milov.nl : forum : coding : 'URL to link with perl'

URL to link with perl btu, 050729 17:11
I have built a new forum and wish to convert all the URLs posted in a message to automatically change into links, here is what i have so far:

$comment[1] =~ s{(?<!\S)(http|mailto|ftp):(\S+)}{ <a href="$1:$2"><font color=cc0000><u>$1:$2</u></font></a>}igsx;

$comment[1] =~ s{ (?<!\S) (www.)(\S+) }{<a href="http://$1$2"><font color=cc0000><u>$1 $2</u></font></a>}igsx;
 

It seems to work, however, sometimes it does not and i do not know why. Does any one know why?
host-233-230-9-69.midco.net
Re: URL to link with perl Jan!, 050811 15:22
Well, could you at least try to give us some of the cases that work and some of those that don't?
44.160-201-80.adsl.skynet.be
Pages: 1