Changeset 9845

Show
Ignore:
Timestamp:
06/27/08 00:24:27 (5 months ago)
Author:
steve-e
Message:

[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.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/gajim.py

    r9830 r9845  
    22722272                #FIXME: recognize xmpp: and treat it specially 
    22732273 
    2274                 links = r"(www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>'\"]+[^!,\.\s<>\)'\"\]]" 
     2274                links = r"((?<=\()[A-Za-z][A-Za-z0-9+.-]*:"\ 
     2275                        r"([A-Za-z0-9+\.-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+"\ 
     2276                        r"(?=\)))|([A-Za-z][A-Za-z0-9+.-]*:([A-Za-z0-9+\.-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+)" 
    22752277                #2nd one: at_least_one_char@at_least_one_char.at_least_one_char 
    22762278                mail = r'\bmailto:\S*[^\s\W]|' r'\b\S+@\S+\.\S*[^\s\W]'