I use ths simple script. Maybe you can use some of it?

Quote:
alias -l swear.words { return word1.word2.word3.word4 }

on @*:text:*:#: {
if ($nick isop #) return
var %x $strip($1-) , %i $numtok($swear.words,46)
while (%i) {
if ($istok(%x,$gettok($swear.words,%i,46),32)) {
;raw -q mode # +b $wildsite
/msg $chan 4 $nick we do not allow swearing in our channel!
/kick # $nick No swearing!
return
}
dec %i
}
}