Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/chat/box.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-04-11 16:39:06 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-04-12 05:34:43 (GMT)
commitfef3df6596d2c1394077f02da2d8f1b308b1f60b (patch)
tree99323ad80579ad787a0be3ccfd2222da56f44313 /chat/box.py
parent6d3f6461556e44eb178a568102795687bb814629 (diff)
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 <humitos@gmail.com>
Diffstat (limited to 'chat/box.py')
-rw-r--r--chat/box.py2
1 files changed, 1 insertions, 1 deletions
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)