Your friends code has issues.
;$1- is de tekst die gecensureerd moet worden
alias censuur {
var %text = $1-
var %i = $hget(censuur,0).data
while ( %i ) {
var %word = $hget(censuur,%i).data
var %text = $iif($regsub($strip(%text),/\b $+ %word $+ \b/ig,$str(*,$len(%word)),%new),%new,%text)
dec %i
}
return %text
}
Obviously, it's a while loop. What's wrong with while loops? Well, using $regsubex to begin with was so you didn't have to use a while loop.
That alias isn't very optimal, you generally want to AVOID doing loops where possible, and btw, all you had to do was change:
Original:
alias cursefilter { return $regsubex($1-,/( $+ %badword $+ )/gi,<censored>) }
To:
alias cursefilter { return $regsubex($1-,/\b( $+ %badword $+ )\b/gi,$str(*,$len(\t))) }
So if you had "pussy" in your badword filter, then "pussycat" would not match it. But if it was "pussy" in the text it'd show up as *****.
I really wouldn't suggest using a while loop. You'll get lagged up if a few bots decide to start flooding you. (Because that loop is going to trigger, regardless if a curse word is in the text or not. NOT good.)