link_urls strWhat it does:
Replace what appear to be URLs with links.Defined in: /web/philip/tcl/chat-defs.tcl
Source code:
# URL courtesy of Zach Beane, somewhat modified. If you can do better, # let me know -jsc@arsdigita.com set url_re {(http|ftp)://[-A-Za-z0-9]+(\.[-A-Za-z0-9]+)+(:[0-9]+)?(/[-^A-Za-z0-9_~\#/]*)?([./][-^A-Za-z0-9_~\#?=%+/]+)*} regsub -all $url_re $str {<a target=newwindow href="\0">\0</a>} str # Try to get "www.photo.net" linked properly (without re-linking # any of the URLs we just linked). set url_re_no_http {([^/])(www\.[-A-Za-z0-9]+(\.[-A-Za-z0-9]+)+(:[0-9]+)?(/[-^A-Za-z0-9_~\#/]*)?([./][-^A-Za-z0-9_~\#?=%+/]+)*)} regsub -all $url_re_no_http $str {\1<a target=newwindow href="http://\2">\2</a>} str return $str