[erlehmann] Improved regular URL matching expressions. Fixes #3715.

URLs like (http://myFoobar.org) and http://en.wikipedia.org/wiki/Mornington_Crescent_(game) are now correctly detected.
This commit is contained in:
Stephan Erb 2008-06-26 22:24:27 +00:00
parent 766decde58
commit 59b9e86fbb
1 changed files with 3 additions and 1 deletions

View File

@ -2271,7 +2271,9 @@ class Interface:
#FIXME: recognize xmpp: and treat it specially
links = r"(www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>'\"]+[^!,\.\s<>\)'\"\]]"
links = r"((?<=\()[A-Za-z][A-Za-z0-9+.-]*:"\
r"([A-Za-z0-9+\.-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+"\
r"(?=\)))|([A-Za-z][A-Za-z0-9+.-]*:([A-Za-z0-9+\.-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+)"
#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]'