For the regex stuff: badword detection is hard, adding some characters, typo's, accented letters instead of normal ones, ... and any script fails
A pretty easy way would be $regex($1-,/\b(?:badword1|badword2|badword3)\b/iS)
This just checks if any of those words are in there, but not inside another word to prevent some false positives
If you want to replace them with *** or something:
var %newtext, %i = $regsub($1-,/\b(?:badword1|badword2|badword3)\b/igS,***,%newtext)
If you want to match the number of stars (make sure * is NOT a badword
)
var %newtext = $1-
while ($regex(%newtext,/^(.*?)\b(badword1|badword2|badword3)\b(.*+)$/iS)) {
var %newtext = $+($regml(1),$str(*,$len($regml(2)),$regml(3)
}
For more tamper proof stuff: you could replace 'badword' with (for example) [b8ß][aáàäâ@ÄÂÁÀÃã][dÐ](?:w|\\\/\\\/)[oóòõôöÔÖÓÒÕ]r[dÐ] but that's probably too much work