Match URL regexp across multiple input lines.
This commit is contained in:
parent
e77c8da57c
commit
f57db3017d
|
@ -44,8 +44,8 @@ def sanitize_safelink(url):
|
||||||
return url
|
return url
|
||||||
|
|
||||||
def unsanitize_txt(content):
|
def unsanitize_txt(content):
|
||||||
return re.sub(
|
url_re = re.compile(r'(http[s]?://(?:[a-zA-Z]|[0-9]|[$-\'\/\+-;=\?-@.&+_]|[!*,]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)', re.MULTILINE)
|
||||||
r'(http[s]?://(?:[a-zA-Z]|[0-9]|[$-\'\/\+-;=\?-@.&+_]|[!*,]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)',
|
return re.sub(url_re,
|
||||||
lambda x: (sanitize_safelink(x.group(1))), content).rstrip()
|
lambda x: (sanitize_safelink(x.group(1))), content).rstrip()
|
||||||
|
|
||||||
def unsanitize_html(content):
|
def unsanitize_html(content):
|
||||||
|
|
Loading…
Reference in New Issue