Commit 4e18462d authored by Yann Leboulanger's avatar Yann Leboulanger

[hđh] improve URL regex. fixes #3350

parent 1b212ce9
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment