diff options
| author | 2024-10-17 22:27:48 +0100 | |
|---|---|---|
| committer | 2024-10-17 22:46:47 +0100 | |
| commit | 8528c7f1191905198c2ae9d064137dc339619afc (patch) | |
| tree | 71d652fd20ab7c3b0fbb252c045f73cfb1fd8d6b /pydis_core | |
| parent | Drop / from invite regex fragements (diff) | |
Improve readability of invite regex by indenting the large OR group
Diffstat (limited to 'pydis_core')
| -rw-r--r-- | pydis_core/utils/regex.py | 18 | 
1 files changed, 10 insertions, 8 deletions
| diff --git a/pydis_core/utils/regex.py b/pydis_core/utils/regex.py index 13a6d220..1ccc0813 100644 --- a/pydis_core/utils/regex.py +++ b/pydis_core/utils/regex.py @@ -4,15 +4,17 @@ import re  DISCORD_INVITE = re.compile(      r"(https?://)?(www\.)?"                      # Optional http(s) and www. -    r"(discord([.,]|dot)gg|"                     # Could be discord.gg -    r"discord([.,]|dot)com|"                     # or discord.com/invite -    r"discordapp([.,]|dot)com|"                  # or discordapp.com/invite -    r"discord([.,]|dot)me|"                      # or discord.me -    r"discord([.,]|dot)li|"                      # or discord.li -    r"discord([.,]|dot)io|"                      # or discord.io -    r"((?<!\w)([.,]|dot))gg"                     # or .gg +    r"(" +        r"discord([.,]|dot)gg|"                  # Could be discord.gg +        r"discord([.,]|dot)com|"                 # or discord.com/invite +        r"discordapp([.,]|dot)com|"              # or discordapp.com/invite +        r"discord([.,]|dot)me|"                  # or discord.me +        r"discord([.,]|dot)li|"                  # or discord.li +        r"discord([.,]|dot)io|"                  # or discord.io +        r"((?<!\w)([.,]|dot))gg"                 # or .gg +    r")"      r"((/|slash|\\)(invite))?"                   # / or \ or 'slash' invite -    r")(/|slash|\\)"                             # / or \ or 'slash' +    r"(/|slash|\\)"                              # / or \ or 'slash'      r"(?P<invite>\S+)",                          # the invite code itself      flags=re.IGNORECASE  ) | 
