Improves link detecting regex

This commit is contained in:
Mouse Reeve
2021-01-06 10:08:43 -08:00
parent a25bc2383b
commit 9e07f094ad
2 changed files with 15 additions and 1 deletions

View File

@ -294,8 +294,9 @@ def find_mentions(content):
def format_links(content):
''' detect and format links '''
return re.sub(
r'([^(href=")]|^)(https?:\/\/([\w\.\-_]+\.[a-z]{2,}(\/[\w\.\-_\/]+)?))',
r'([^(href=")]|^)(https?:\/\/(%s([\w\.\-_\/])*))' % regex.domain,
r'\g<1><a href="\g<2>">\g<3></a>',
content)