My string is called $in{'message'} and it would contain something like this.....
$in{'message'} = "hello... a great website for that is [whatever.com...] ";
I want it to detect urls in the string and convert them to the necessary html.
Looked everywhere and haven't found anything :-(
Please help me. Thanks in advance, John
my $message = qq~This is a great site [site.com...] and I love this one too www.othersite.com and also [secure.com...] and ftp://myftp.com~;
$message =~ s/(https?¦ftp)(:\/\/)?([\w.-]+)/<a href="$1:\/\/$3">$1:\/\/$3<\/a>/ig;
print $message
note that www.othersite.com does not get converted into a hyper-link with the above code. And not that this message board does not convert links that begin with https and ftp into hyper-links.
[edited by: coopster at 4:39 pm (utc) on Sep. 7, 2005]
[edit reason] fixed sidescroll [/edit]
It just printed out the string and didn't converted it.
(I did have to put a semi-colon on the end of the print line but it stiill didn't work)
I dont have a baldy how the code in a line like that works so I'd be glad if you can help. While I'm waiting I'll try the ULR::FIND thingy.
Thanks a lot if you can help
John
I tried that code as it was....It just printed out the string and didn't converted it.
(I did have to put a semi-colon on the end of the print line but it stiill didn't work)
I dont have a baldy how the code in a line like that works so I'd be glad if you can help. While I'm waiting I'll try the ULR::FIND thingy.
Thanks a lot if you can help
John
post what you tried and the string. The code I posted works, so I suspect a problem elsewhere in your code.