From c9daa6f3774380794968cf28faf9ba4bde1f68e2 Mon Sep 17 00:00:00 2001 From: GDWR Date: Tue, 10 May 2022 18:49:12 +0100 Subject: `DISCORD_INVITE` captures until a whitespace --- botcore/utils/regex.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'botcore') diff --git a/botcore/utils/regex.py b/botcore/utils/regex.py index abcaf299..5146a113 100644 --- a/botcore/utils/regex.py +++ b/botcore/utils/regex.py @@ -11,13 +11,17 @@ DISCORD_INVITE = re.compile( r"discord([.,]|dot)io|" # or discord.io. r"((?[a-zA-Z0-9\-]+)", # the invite code itself + r"(?P\S+)", # the invite code itself flags=re.IGNORECASE ) """ Regex for Discord server invites. :meta hide-value: +.. warning:: + This regex pattern will capture until a whitespace, if you are to use the 'invite' capture group in + any HTTP requests or similar. Please ensure you sanitise the output using something similar to + https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote. """ FORMATTED_CODE_REGEX = re.compile( -- cgit v1.2.3