What is Regex and how do I filter messages?

 

What is Regex?

Regex (or regular expression) is a sequence of characters that define a search pattern.
It can be used to search incoming messages for certain patterns that are unfavourable in your server, for example, Discord invites, Email addresses or some words you don't want to be used.

How do I create Regex to my liking?

Unfortunately, if you've never heard of Regex before, you'll have to research on your own, however, if you want to test the Regex out, you have some knowledge, but don't remember everything, you can create regex and test it here: Regex 101 Website The example, I will show will delete any messages, that include Discord invites (this regex can be bypassed, feel free to improve it):

Regex example

How do I enable Regex on my server?

  • While adding regex to your server, keep in mind 3 parameters: regex itself, target channel and roles that will not be affected by it.
    If you want a simple regex that will work everywhere and for everyone you can simply type:
    x.regex YOURREGEX
  • If you want this regex to work only in the specific channel, use:
    x.regex YOURREGEX||CHANNEL
    Keep in mind that "CHANNEL" can be channel ID, channel mention or even channel name. Also, you can say "global" instead of specifying the channel, to make the regex work on every channel.
  • If you want certain roles to not be affected by it, you can list them in the certain way:
    x.regex YOURREGEX||CHANNEL||Role1,Role2
    You can add as many roles, but make sure, you have not missed CHANNEL. Again, if you don't want to specify any channel, just type:
    x.regex YOURREGEX||global||Role1,Role2

How do I list or disable Regex on my server?

  • If you want to list all of the Regex filters set on your server, simply type:
    x.regex list
    Regex for each channel will be displayed in the form of CHANNEL >> REGEX // ROLES_UNAFFECTED
  • Unlike addition, the only thing you need to specify here is the channel. General command for removing regex is:
    x.regex remove CHANNEL
  • If you want to remove Regex, that is global (works in all channels) you can either specify channel as "global" or simply type:
    x.regex remove
    Keep in mind that "CHANNEL" can be channel ID, channel mention or even channel name. Also, you can say "global" instead of specifying the channel, to delete regex that works across all channels.

Can I toggle DM messages?

  • Yup! DM notifications are ON by default to avoid possible confusion, however it can be toggled on or off by:
    x.regex dm
    This will completely stop notifying users when their message is deleted with Regex Filtering.