my $str="McGlaughlin http://www.karayiannis.com and http://www.samy.com"; $str =~ s/\b((?:http\:\/\/)|(?:www\.))([^ ]+)/$&<\/a>/sgi; print $str; __END__ McGlaughlin http://www.karayiannis.com and http://www.samy.com