$regex($1-,/^(\bwordA\b|\bwordB\b|\bwordC\b)$/giS)
is functionally equivalent to:
$regex($1-,/^(wordA|wordB|wordC)$/iS)
Both the above expressions match only on wordA OR wordB OR wordC. If any other text preceeds or follows the word it will not match. Even if more exact matches are part of the string. The \b word boundary is unnecessary because with ^ it must begin with wordA OR wordB OR wordC and with $ it must also end with it. The g switch is unnecessary because it can only match a single word anyway. Of course the i switch ignores case and the S switch strips mIRC control codes. Also for a 'swear kicker' the g switch is not really needed because if it matches it does not need to continue searching and go ahead and kick.
Try this for testing purposes:
; usage: /rx wordA wordc blahwordBlah
alias rx {
linesep
if $regex($1-,/^(\bwordA\b|\bwordB\b|\bwordC\b)$/giS) { echo -a original: $1- }
if $regex($1-,/^(wordA|wordB|wordC)$/iS) { echo -a exact match: $1- }
if $regex($1-,/(\bwordA\b|\bwordB\b|\bwordC\b)/giS) {
var %i 1,%r
while $regml(%i) {
%r = %r $v1
inc %i
}
echo -a word match: %r
}
if $regex($1-,/(wordA|wordB|wordC)/giS) {
var %i 1,%r
while $regml(%i) {
%r = %r $v1
inc %i
}
echo -a string match: %r
}
linesep
}