Simple Caps Lock kicker :P
on @*:TEXT:*:#: {
if ($len($1-) > 16) && ($calc(($len($1-) - $len($removecs($1-,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z))) / $len($1-) * 100) > 40) {
ban -ku60 # $nick 1 huh..
}
}
Yes, jaytea. I already know the effect existed between $1 and $regml() for /S. If someone uses regex match text section for $regml(1) and then use $2 $3, etc, they're not gonna be stripped but the $regml(1).
Anyway, I do appreciate your taking the time for the humble explanation. I'll take note of that.
with the 'S' modifier, all that occurs is mIRC will strip control codes (as $strip() does) before passing the text to the regex engine - a side effect of this is that $regml() will return stripped results and $regml().pos will refer to positions in the stripped string. it does not affect the value of $1- in the event.
since the expression '([A-Z])' only matches a single character that is never part of a control code, the only purpose that including the 'S' modifier serves is that the values of $regml().pos will be modified in a manner that is arguably unfavourable (but that's not relevant here :P). so as it stands, /S doesn't change the behaviour of the given example, but there is the implication that control codes should not be considered, which is why i suggested $strip($1-) in place of $1-.
and yes, the lack of a $len() check looks like it was an unfortunate oversight :P although even without the check it serves as an example of a simple method for calculating the percentage of capital letters in a string - it's just a shame that it isn't documented for the benefit of newcomers to coding.
in case it wasn't obvious: Spoofing made this as a joke or parody of sorts ;P he realizes $calc($len($1-) - $removecs($1-, A, B, C)) = $countcs(str, A, B, C) when A, B and C are single characters and is just mimicking the thought process of a new user to the language for nostalgic purposes (based on a comment he made earlier).
also Jethro, that regex version is incorrect; you mean to use $regml(0) in place of $regml(1) in the first case, and $1- in place of $regml(1) in the second. also, i'm not sure if you used //S out of habit since it's unnecessary here, but if you actually want to not consider control codes it would follow that you'd want to take $len($strip($1-)) as the length of the text.