Posted to tcl by kevin_walzer at Wed May 25 13:26:50 GMT 2011view raw
- pack [text .t]
- .t tag config URL -underline 1
- .t tag bind URL <Enter> [list .t configure -cursor hand2]
- .t tag bind URL <Leave> [list .t configure -cursor left_ptr]
- set test {the text is http://wiki.tcl.tk}
- foreach item $test {
- if {[regexp {(http|https|sftp|ftp|file)://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?} $test->url]} {
- lappend tag URL
- .t insert end $item $tag
- } else {
- .t insert end $item
- }
- .t insert end \n
- }