comparison sat_frontends/tools/strings.py @ 3107:a754523fc0f6

frontends (tools/strings): added "geo:" scheme in RE_URL
author Goffi <goffi@goffi.org>
date Fri, 03 Jan 2020 17:10:53 +0100
parents 56f94936df1e
children 559a625a236b
comparison
equal deleted inserted replaced
3106:7f7cdc6ecfd8 3107:a754523fc0f6
19 19
20 import re 20 import re
21 21
22 # Regexp from http://daringfireball.net/2010/07/improved_regex_for_matching_urls 22 # Regexp from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
23 RE_URL = re.compile( 23 RE_URL = re.compile(
24 r"""(?i)\b((?:[a-z]{3,}://|(www|ftp)\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/|mailto:|xmpp:)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?]))""" 24 r"""(?i)\b((?:[a-z]{3,}://|(www|ftp)\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/|mailto:|xmpp:|geo:)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?]))"""
25 ) 25 )
26 26
27 27
28 # TODO: merge this class with an other module or at least rename it (strings is not a good name) 28 # TODO: merge this class with an other module or at least rename it (strings is not a good name)
29 29