[Tkabber-dev] r776 - in trunk/tkabber: . plugins/richtext

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Nov 3 23:17:31 MSK 2006


Author: sergei
Date: 2006-11-03 23:17:28 +0300 (Fri, 03 Nov 2006)
New Revision: 776

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/richtext/urls.tcl
Log:
	* plugins/richtext/urls.tcl: Fixed URL regular expression.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-11-03 19:58:27 UTC (rev 775)
+++ trunk/tkabber/ChangeLog	2006-11-03 20:17:28 UTC (rev 776)
@@ -1,5 +1,7 @@
 2006-11-03  Sergei Golovan  <sgolovan at nes.ru>
 
+	* plugins/richtext/urls.tcl: Fixed URL regular expression.
+
 	* richtext.tcl: Wrapper around text widget, which allows to use
 	  customizable message render plugins (thanks to Konstantin
 	  Khomoutov).

Modified: trunk/tkabber/plugins/richtext/urls.tcl
===================================================================
--- trunk/tkabber/plugins/richtext/urls.tcl	2006-11-03 19:58:27 UTC (rev 775)
+++ trunk/tkabber/plugins/richtext/urls.tcl	2006-11-03 20:17:28 UTC (rev 776)
@@ -15,7 +15,9 @@
     # TODO add user:pass@ match
     # TODO sync TLDs with http://www.icann.org/tlds/app-index.htm
     set url_regexp {
-	(\y
+	(^|\s)
+	([^\w\d]*)
+	(
 	    (?:
 		(?: ftp|https?)://[-\w]+(\.\w[-\w]*)*
 		  |
@@ -46,7 +48,9 @@
 		    [.,?!:;]+ [^.,?!:;"'<>()\[\]{}\s\x7F-\xFF]+
 		)*
 	    )?
-	\y)
+	)
+	([^\w\d]*)
+	(\s|$)
     }
 }
 
@@ -92,7 +96,7 @@
     variable url_regexp
 
     set matched [regexp -expanded -nocase -indices \
-			-start $at -- $url_regexp $what -> bounds]
+			-start $at -- $url_regexp $what -> _ _ bounds]
 
     if {!$matched} { return false }
 



More information about the Tkabber-dev mailing list