May 8, 2001, 11:11 AM
Post #2 of 2
You can try this:
|This seems to work, but you may try tweeking it to make it more robust.
my $text = 'this is text with a link to http://www.perl.com and to www.perldoc.com';
$text =~ s!(^|\s)(http://\S+)!<a href="$2">$2</a>!ig; # get all 'http://' links
$text =~ s!(^|\s)(www\.\w+\.\S+)!<a href="http://$2">$2</a>!ig; # get anything that simply starts 'www.'