Skip to main content

Implementing Chat Moderation with Regex

Level: Intermediate

In this guide, we will be showing how to implement chat moderation step-by-step and explain how to make use of regex.

This guide assumes you already have a chat moderation plugin that has a similar configuration or makes use of regex. If that's not the case, you should use ChatControl™ - The Ultimate Chat Plugin.

Step 1: Going to your server

  • See our login instructions guide over here!

  • Go to your Inventory.

  • Once in your inventory, you will see your list of servers.

  • Click the Manage button of your Minecraft server that you wish to use for your custom IP.

Step 2: Installing a chat control plugin (optional step)

  • If you already have a chat moderation plugin installed, you can skip this step.

  • Head to the Plugins tab and type "ChatControl" in the search field, press ENTER to confirm the search. In the search result, find ChatControl and click the Install button and wait for the installation to finish.

  • "ChatControl™ - The Ultimate Chat Plugin" is our recommended plugin due to the advanced features it has and how it can cover a range of areas such as command moderation.

  • Make sure to restart your server, so the plugin has been loaded!

Step 3: Locating your plugin configuration

  • Select the File Manager tab from the menu bar to load the File Manager.

  • Open the plugin folder, locate the folder with the name of your plugin and open it.

    • If you are using chat control, it'd be ChatControl.
  • You will see many options. For now, what we want to do is implement chat moderation, but you are welcome to come back and configure the rest to your preference.

  • Open the rules folder and open the chat.txt File, which contains every rule that affects the chat.

Step 4: Configuring the plugin

The rules configuration file of Chat Control uses Regular Expression (regex), this guide will go through some basic ones. We recommend using to help create and test your regex, as it lets you create regexes and test them against phrases. You can also check out this cheat sheet for more regex tips.

  • Regex is short for Regular expression and its main usage is to detect patterns you tell want it to, regexes can range from a simple ^dog which would look for anything that start with dog to ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$ which you'd use to find In addresses.

  • Chat Control contains a few examples to show you how you can configure the moderation rules, of the plugin. Let's add some of our own.

  • Make some space somewhere in the document by adding new lines (enter), write the following piece of text into the file editor.

    # ----- i want to prevent people from saying badword1 and its variation 
    match b[@b]*a[@a]*d[@d]*w[@w]*o[@o]*r[@r]*d[@d]*1
    then warn &cPlease do not use cursewords.
    then deny
    # ---- I want to prevent people from saying badword2.
    match badword2
    then warn &cDont be like that!
    then deny
    • In the above example, badword1 and badword2 are just placeholders and should be replaced with real words that you want to moderate.
  • Congrats, you just blocked those words from being said in your server. You may be wondering why bother using regex, like I could just block a ton of words without this fancy random gibberish. Using the regex for badword1 you just blocked numerous variations or bypasses for this word, whereas you might have had to write out all of those variations. Make sure to save the file (Ctrl+S works).

Step 5: Testing the filter

Make sure you are not an operator nor have the bypass permission (refer to your plugin's permission info page) as you will likely not be censored due to permissions.

  • Once you have saved the changes made to chat.txt, head to the Console tab or your in-game console and run chc reload. This command will reload the Chat Control plugin and apply the changes you have made. You could also restart your server to apply the changes.

  • Feel free to try saying words like badword1, badworddd1 and badword2, you will notice these words are now fully censored.

If you are having trouble with this, you can open a support ticket here!
Feedback and suggestions regarding this article are welcome in our Discord server.