From fef3df6596d2c1394077f02da2d8f1b308b1f60b Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 11 Apr 2012 16:39:06 +0000 Subject: Don't treat the whole word as an URL Changed re.search to re.match because .search scan through the whole string looking for the regex. So, for example "asodijfosidwww.google.comaosdfoisad" with .search will be treated as a whole URL. With .match the complete word will be treated as an URL if the whole word matches with the regular expression. Signed-off-by: Manuel Kaufmann --- (limited to 'chat') diff --git a/chat/box.py b/chat/box.py index 91c33b9..bd8625b 100644 --- a/chat/box.py +++ b/chat/box.py @@ -210,7 +210,7 @@ class TextBox(gtk.TextView): words = text.split() for word in words: - if _URL_REGEXP.search(word) is not None: + if _URL_REGEXP.match(word) is not None: tag = buf.create_tag(None, foreground="blue", underline=pango.UNDERLINE_SINGLE) tag.set_data("url", word) -- cgit v0.9.1