Skip to content

Commit 8528c7f

Browse files
committed
Improve readability of invite regex by indenting the large OR group
1 parent e0d6f92 commit 8528c7f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pydis_core/utils/regex.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
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|" # or discord.com/invite
9-
r"discordapp([.,]|dot)com|" # or discordapp.com/invite
10-
r"discord([.,]|dot)me|" # or discord.me
11-
r"discord([.,]|dot)li|" # or discord.li
12-
r"discord([.,]|dot)io|" # or discord.io
13-
r"((?<!\w)([.,]|dot))gg" # or .gg
7+
r"("
8+
r"discord([.,]|dot)gg|" # Could be discord.gg
9+
r"discord([.,]|dot)com|" # or discord.com/invite
10+
r"discordapp([.,]|dot)com|" # or discordapp.com/invite
11+
r"discord([.,]|dot)me|" # or discord.me
12+
r"discord([.,]|dot)li|" # or discord.li
13+
r"discord([.,]|dot)io|" # or discord.io
14+
r"((?<!\w)([.,]|dot))gg" # or .gg
15+
r")"
1416
r"((/|slash|\\)(invite))?" # / or \ or 'slash' invite
15-
r")(/|slash|\\)" # / or \ or 'slash'
17+
r"(/|slash|\\)" # / or \ or 'slash'
1618
r"(?P<invite>\S+)", # the invite code itself
1719
flags=re.IGNORECASE
1820
)

0 commit comments

Comments
 (0)