From 4e18462d7841f43b5869185b4c5ec5c11a5db5e0 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 9 Dec 2007 10:33:36 +0000 Subject: [PATCH] =?UTF-8?q?[h=C3=84=C2=91h]=20improve=20URL=20regex.=20fix?= =?UTF-8?q?es=20#3350?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat_control.py | 2 +- src/gajim.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index d78a7f1c5..3474895a4 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -151,7 +151,7 @@ class ChatControlBase(MessageControl): self._on_banner_eventbox_button_press_event) self.handlers[id] = widget - self.urlfinder = re.compile("(https?://|www|ftp)[^ ]+") + self.urlfinder = re.compile(r"(www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>'\"]+[^!,\.\s<>\)'\"\]]") if gajim.HAVE_PYSEXY: import sexy diff --git a/src/gajim.py b/src/gajim.py index d268e0ae2..4453ab8be 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -2328,7 +2328,7 @@ class Interface: #FIXME: recognize xmpp: and treat it specially - links = r'\b(%s)\S*[\w\/\=]|' % prefixes + links = r"(www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>'\"]+[^!,\.\s<>\)'\"\]]" #2nd one: at_least_one_char@at_least_one_char.at_least_one_char mail = r'\bmailto:\S*[^\s\W]|' r'\b\S+@\S+\.\S*[^\s\W]' @@ -2340,7 +2340,7 @@ class Interface: latex = r'|\$\$[^$\\]*?([\]\[0-9A-Za-z()|+*/-]|[\\][\]\[0-9A-Za-z()|{}$])(.*?[^\\])?\$\$' - basic_pattern = links + mail + basic_pattern = links + '|' + mail if gajim.config.get('use_latex'): basic_pattern += latex