From 1856ed852515c17c2095c10b93d4d418787ec178 Mon Sep 17 00:00:00 2001 From: Andi Qu Date: Wed, 13 Jan 2021 19:10:03 +0200 Subject: Better regex now works for --- bot/exts/info/code_snippets.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bot/exts/info/code_snippets.py b/bot/exts/info/code_snippets.py index 1899b139b..1d1bc2850 100644 --- a/bot/exts/info/code_snippets.py +++ b/bot/exts/info/code_snippets.py @@ -12,27 +12,27 @@ from bot.utils.messages import wait_for_deletion log = logging.getLogger(__name__) GITHUB_RE = re.compile( - r'https://github\.com/(?P\S+?)/blob/(?P\S+/[^\s#]+)' - r'(#L(?P\d+)([-~:]L(?P\d+))?)?($|\s)' + r'https://github\.com/(?P\S+?)/blob/(?P\S+/[^\s#,>]+)' + r'(#L(?P\d+)([-~:]L(?P\d+))?)?($|\s|,|>)' ) GITHUB_GIST_RE = re.compile( r'https://gist\.github\.com/([^/]+)/(?P[^\W_]+)/*' r'(?P[^\W_]*)/*#file-(?P\S+?)' - r'(-L(?P\d+)([-~:]L(?P\d+))?)?($|\s)' + r'(-L(?P\d+)([-~:]L(?P\d+))?)?($|\s|,|>)' ) GITHUB_HEADERS = {'Accept': 'application/vnd.github.v3.raw'} GITLAB_RE = re.compile( - r'https://gitlab\.com/(?P\S+?)/\-/blob/(?P\S+/[^\s#]+)' - r'(#L(?P\d+)([-](?P\d+))?)?($|\s)' + r'https://gitlab\.com/(?P\S+?)/\-/blob/(?P\S+/[^\s#,>]+)' + r'(#L(?P\d+)([-](?P\d+))?)?($|\s|,|>)' ) BITBUCKET_RE = re.compile( r'https://bitbucket\.org/(?P\S+?)/src/' - r'(?P\S+?)/(?P[^\s#]+)' - r'(#lines-(?P\d+)(:(?P\d+))?)?($|\s)' + r'(?P\S+?)/(?P[^\s#,>]+)' + r'(#lines-(?P\d+)(:(?P\d+))?)?($|\s|,|>)' ) -- cgit v1.2.3