What you're asking for is similar to this thread: https://forums.mirc.com/ubbthreads.php/topics/264491/re-bad-word-in-txt-file#Post264491
The problem with your method is that you require a separate if () evaluation for every bad word in the list. Another problem with 'isin' is that it can easily match things it should not, like:
//if (word isin sword) echo -a match
The link shows how using $hfind can accomplish your task much quicker, because there can be 1 function call which matches all badwords against the entire $1- in 1 identifier call. It uses Regex, and while it looks more complicated, you can have much better ability to prevent false matches by having your bad word be required to be a complete word instead of only being a portion of it.
//hadd -m badwords word1 *perra* | hadd badwords word2 *cybersex* | hadd badwords word3 *striper* | echo -a $hfind(badwords,foo perra bar,1,W).data
This is a quick example where $hfind can compare all words in your list at the same time against $1-
For this to work, you can create a hashtable where the itemname is a unique word, it doesn't matter what it is, and the data is where you put the badword as a wildcard string. The capital W switch means that the wildcard string is in the hashtable, and using the .data makes it try to match the data instead of the itemname.
The hashtable lives in memory, so it disappears when you quit mirc, unless you save it to disk like
/hsave -s badwords badwords.txt
... and the next time you start mirc, you can either use the commands above to re-make the bad word list, or you can load the list off disk like:
/hload -s badwords badwords.txt
I could have made the badword be the itemname instead of the data, but that would not allow you to have the badword be a string of several words.
In my example, $hfind returned the item name where the data contained the bad word. If word1 is returned by $hfind, you can use $hget(badword,word1) to see what the match found.