From 4dee6d3c4e18144b35011fc4441738a82fcb522b Mon Sep 17 00:00:00 2001 From: Andi Qu <31325319+dolphingarlic@users.noreply.github.com> Date: Sat, 30 Jan 2021 11:43:14 +0200 Subject: Got rid of unnecessary regex matching things Stuff like `/{0,1}` and `?` at the ends of groups --- bot/exts/info/code_snippets.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bot/exts/info/code_snippets.py b/bot/exts/info/code_snippets.py index e825ec513..4c8de05fc 100644 --- a/bot/exts/info/code_snippets.py +++ b/bot/exts/info/code_snippets.py @@ -14,7 +14,7 @@ log = logging.getLogger(__name__) GITHUB_RE = re.compile( r'https://github\.com/(?P[a-zA-Z0-9-]+/[\w.-]+)/blob/' - r'(?P[^#>]+/{0,1})(\?[^#>]+)?(#L(?P\d+)([-~:]L(?P\d+))?)' + r'(?P[^#>]+)(\?[^#>]+)?(#L(?P\d+)([-~:]L(?P\d+))?)' ) GITHUB_GIST_RE = re.compile( @@ -26,13 +26,13 @@ GITHUB_GIST_RE = re.compile( GITHUB_HEADERS = {'Accept': 'application/vnd.github.v3.raw'} GITLAB_RE = re.compile( - r'https://gitlab\.com/(?P[\w.-]+/[\w.-]+)/\-/blob/(?P[^#>]+/{0,1})' + r'https://gitlab\.com/(?P[\w.-]+/[\w.-]+)/\-/blob/(?P[^#>]+)' r'(\?[^#>]+)?(#L(?P\d+)(-(?P\d+))?)' ) BITBUCKET_RE = re.compile( - r'https://bitbucket\.org/(?P[a-zA-Z0-9-]+/[\w.-]+?)/src/(?P[0-9a-zA-Z]+?)' - r'/(?P[^#>]+?)(\?[^#>]+)?(#lines-(?P\d+)(:(?P\d+))?)' + r'https://bitbucket\.org/(?P[a-zA-Z0-9-]+/[\w.-]+)/src/(?P[0-9a-zA-Z]+)' + r'/(?P[^#>]+)(\?[^#>]+)?(#lines-(?P\d+)(:(?P\d+))?)' ) -- cgit v1.2.3