aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/info/code_snippets.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/bot/exts/info/code_snippets.py b/bot/exts/info/code_snippets.py
index 3469b88f4..84f606036 100644
--- a/bot/exts/info/code_snippets.py
+++ b/bot/exts/info/code_snippets.py
@@ -13,27 +13,27 @@ from bot.utils.messages import wait_for_deletion
log = logging.getLogger(__name__)
GITHUB_RE = re.compile(
- r'https://github\.com/(?P<repo>\S+?)/blob/(?P<path>\S+/[^\s#,>]+)'
- r'(#L(?P<start_line>\d+)([-~:]L(?P<end_line>\d+))?)?($|\s|,|>)'
+ r'https://github\.com/(?P<repo>[a-zA-Z0-9-]+/[\w.-]+)/blob/'
+ r'(?P<path>[^#>]+/{0,1})(#L(?P<start_line>\d+)([-~:]L(?P<end_line>\d+))?)'
)
GITHUB_GIST_RE = re.compile(
r'https://gist\.github\.com/([^/]+)/(?P<gist_id>[^\W_]+)/*'
r'(?P<revision>[^\W_]*)/*#file-(?P<file_path>\S+?)'
- r'(-L(?P<start_line>\d+)([-~:]L(?P<end_line>\d+))?)?($|\s|,|>)'
+ r'(-L(?P<start_line>\d+)([-~:]L(?P<end_line>\d+))?)'
)
GITHUB_HEADERS = {'Accept': 'application/vnd.github.v3.raw'}
GITLAB_RE = re.compile(
r'https://gitlab\.com/(?P<repo>\S+?)/\-/blob/(?P<path>\S+/[^\s#,>]+)'
- r'(#L(?P<start_line>\d+)([-](?P<end_line>\d+))?)?($|\s|,|>)'
+ r'(#L(?P<start_line>\d+)([-](?P<end_line>\d+))?)'
)
BITBUCKET_RE = re.compile(
r'https://bitbucket\.org/(?P<repo>\S+?)/src/'
r'(?P<ref>\S+?)/(?P<file_path>[^\s#,>]+)'
- r'(#lines-(?P<start_line>\d+)(:(?P<end_line>\d+))?)?($|\s|,|>)'
+ r'(#lines-(?P<start_line>\d+)(:(?P<end_line>\d+))?)'
)