[hÄh] improve URL regex. fixes #3350
This commit is contained in:
parent
1b212ce90d
commit
4e18462d78
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue