Skip to content

Commit e0d6f92

Browse files
committed
Drop / from invite regex fragements
There is already a fragment that captures slashes further down in the regex
1 parent 06b1ada commit e0d6f92

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pydis_core/utils/regex.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
DISCORD_INVITE = re.compile(
66
r"(https?://)?(www\.)?" # Optional http(s) and www.
7-
r"(discord([.,]|dot)gg|" # Could be discord.gg/
8-
r"discord([.,]|dot)com(/|slash)invite|" # or discord.com/invite/
9-
r"discordapp([.,]|dot)com(/|slash)invite|" # or discordapp.com/invite/
7+
r"(discord([.,]|dot)gg|" # Could be discord.gg
8+
r"discord([.,]|dot)com|" # or discord.com/invite
9+
r"discordapp([.,]|dot)com|" # or discordapp.com/invite
1010
r"discord([.,]|dot)me|" # or discord.me
1111
r"discord([.,]|dot)li|" # or discord.li
12-
r"discord([.,]|dot)io|" # or discord.io.
13-
r"((?<!\w)([.,]|dot))gg" # or .gg/
12+
r"discord([.,]|dot)io|" # or discord.io
13+
r"((?<!\w)([.,]|dot))gg" # or .gg
14+
r"((/|slash|\\)(invite))?" # / or \ or 'slash' invite
1415
r")(/|slash|\\)" # / or \ or 'slash'
1516
r"(?P<invite>\S+)", # the invite code itself
1617
flags=re.IGNORECASE

0 commit comments

Comments
 (0)