Skip to content

Commit

Permalink
Remove repetition from the invite regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed Oct 17, 2024
1 parent 4df8e90 commit 5911e10
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pydis_core/utils/regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@
DISCORD_INVITE = re.compile(
r"(https?://)?(www\.)?" # Optional http(s) and www.
r"(discord(app)?)?" # Optional discord(app)
r"("
r"([.,]|dot)gg|" # Could be .gg
r"([.,]|dot)com|" # or .com
r"([.,]|dot)me|" # or .me
r"([.,]|dot)li|" # or .li
r"([.,]|dot)io" # or .io
r")"
r"([.,]|dot)" # Various characters to cover dots
r"(gg|com|me|li|io)" # A few TLDs that embed within discord
r"((/|slash|\\)(invite))?" # / or \ or 'slash' invite
r"(/|slash|\\)" # / or \ or 'slash'
r"(?P<invite>\S+)", # the invite code itself
Expand Down

0 comments on commit 5911e10

Please sign in to comment.