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

This commit is contained in:
Yann Leboulanger 2007-12-09 10:33:36 +00:00
parent 1b212ce90d
commit 4e18462d78
2 changed files with 3 additions and 3 deletions

View File

@ -151,7 +151,7 @@ class ChatControlBase(MessageControl):
self._on_banner_eventbox_button_press_event) self._on_banner_eventbox_button_press_event)
self.handlers[id] = widget 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: if gajim.HAVE_PYSEXY:
import sexy import sexy

View File

@ -2328,7 +2328,7 @@ class Interface:
#FIXME: recognize xmpp: and treat it specially #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 #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]' 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()|{}$])(.*?[^\\])?\$\$' latex = r'|\$\$[^$\\]*?([\]\[0-9A-Za-z()|+*/-]|[\\][\]\[0-9A-Za-z()|{}$])(.*?[^\\])?\$\$'
basic_pattern = links + mail basic_pattern = links + '|' + mail
if gajim.config.get('use_latex'): if gajim.config.get('use_latex'):
basic_pattern += latex basic_pattern += latex