Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Regex

Regex is a text string used for searching text. You can encounter it, for example, in the Purpur config: username-valid-characters: ^[a-zA-Z0-9_.]*$. In this example, setting the regex ^[a-zA-Z0-9_.]*$ for username-valid-characters means that players whose name contains the letters a through z (without diacritics), A through Z, the numbers 0 through 9, an underscore, and a period can join.

If you need to create/edit a regex (for example, adding a character to the allowed characters in a name, since Bedrock players have a special character before their name due to Floodgate) and you don’t know what to do, LLM (AI) tools like OpenAI’s ChatGPT or Google’s Gemini will usually give you the correct regex. You can also ask somebody. If you don’t know where, Discord programming language servers may be the ideal place. However, it’s a good idea not to blindly trust the regex you get and test to see if it works correctly. For this purpose you can use the tool regex101 (for “Flavor” choose “Java 8”), which also explains the regex nicely.