in reply to extracting links from text

Gnome-terminal (which I know do this) uses the following scheme:

If something starts with www or http:// it is recognised as a link up until the next illegal (in a link) char plus newlines. However if the last char is a . or , it is ignored.
in perl language somthing like:
@links = m/((?:www|http:\/\/)[anything allowed in a link \n]*)/ig; for (0..@"#links) { $links[$_] =~ s/.$//; $links[$_] =~ tr/\n//d; #Remove inline newlines. }


T I M T O W T D I