Skip to content

Commit 7dfdd3f

Browse files
committed
Remove repetition from the invite regex
1 parent bafaf69 commit 7dfdd3f

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pydis_core/utils/regex.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@
55
DISCORD_INVITE = re.compile(
66
r"(https?://)?(www\.)?" # Optional http(s) and www.
77
r"(discord(app)?)?" # Optional discord(app)
8-
r"("
9-
r"([.,]|dot)gg|" # Could be .gg
10-
r"([.,]|dot)com|" # or .com
11-
r"([.,]|dot)me|" # or .me
12-
r"([.,]|dot)li|" # or .li
13-
r"([.,]|dot)io" # or .io
14-
r")"
8+
r"([.,]|dot)" # Various characters to cover dots
9+
r"(gg|com|me|li|io)" # A few TLDs that embed within discord
1510
r"((/|slash|\\)(invite))?" # / or \ or 'slash' invite
1611
r"(/|slash|\\)" # / or \ or 'slash'
1712
r"(?P<invite>\S+)", # the invite code itself

0 commit comments

Comments
 (0)