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 <[email protected]> --- chat/box.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 1.7.9.5 _______________________________________________ Sugar-devel mailing list [email protected] http://lists.sugarlabs.org/listinfo/sugar-devel

