Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Examples of miscellaneous useful regex:
- #TRIM out excessive letter spam
- match (?i)(.)\1{3}
- then replace $1
- Explanation:
- "(?i)" is the case-insensitive flag so it will match capital and lower-case letters.
- "(.)" is a regex capture group that matches any character except a new line.
- "\1" is the first group we captured. This will match whatever we just matched again.
- "{3}" is used to match exactly 3 of the previous match, which is group 1.
- We use "then replace $1" to replace the match with group 1.
- In the case of the string "AhhHhhhHHHhhHhhhhh!", it will capture all the letters in which there are 3 in a row and replace them with the captured group, which was the single letter. With how ChatControl works, this will run each time until it no longer matches 3 of the letter in a row, giving us a final result of "Ah!".
- #Prevent owner hate
- match owner is (?:a|an) (?:dick|noob|loser|ass|bitch|retard)
- id ServerHate
- then replace i luv justin beiber
- then notify chatcontrol.notify.rulesalert &8[&7ID {ruleID}&8] &7{player}: &f{message}
- then console kick {player} &cI don't think so.
- Explanation:
- This one uses passive groups ("(?:<regex_here>)") to check for words that add up to an unpleasant phrase regarding the owner. We use ChatControl's "then replace" to replace the matched string with another one. In this case an appropriate "i love justin beiber". We also use "notify" to notify any players online who have the specified permission about the incident. Then we use "console" to run a command from console; in this case we use the kick command to kick the player.
- #Replace dafuq with wtf
- match (?i)dafuq
- id rude
- then replace wtf
- #Deny any chat containing the swastika Unicode symbol
- match \u534D|\u5350
- id rude
- then deny
Advertisement
Add Comment
Please, Sign In to add comment