Skip to content

Commit 21caddb

Browse files
committed
Move discord(app) capture to its own optional group in invite regex
1 parent 23434f0 commit 21caddb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pydis_core/utils/regex.py

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

55
DISCORD_INVITE = re.compile(
66
r"(https?://)?(www\.)?" # Optional http(s) and www.
7+
r"(discord(app)?)?" # Optional discord(app)
78
r"("
8-
r"discord(app)?([.,]|dot)gg|" # Could be discord(app).gg
9-
r"discord(app)?([.,]|dot)com|" # or discord(app).com/invite
10-
r"discord(app)?([.,]|dot)me|" # or discord(app).me
11-
r"discord(app)?([.,]|dot)li|" # or discord(app).li
12-
r"discord(app)?([.,]|dot)io|" # or discord(app).io
13-
r"((?<!\w)([.,]|dot))gg" # or .gg
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
1414
r")"
1515
r"(/|slash|\\)" # / or \ or 'slash'
1616
r"(?P<invite>\S+)", # the invite code itself

0 commit comments

Comments
 (0)