mIRC Homepage
Posted By: Maveric Counting the number of control codes used. - 31/05/03 06:26 PM
How do you count the number of control codes someone used in a message WITHOUT having to strip it in the mIRC options and using $stripped?? That seems to be the only way I can get results, but I don't want to strip all the messages.
if u mean control codes by ALL control codes that is chr 1-31 too so u can use $regex($1-,/[[:cntrl]]/g)
and if u want just color,bold,underline,reverse
u can use $calc($len($1-) - $len($strip($1-)))
Posted By: Nimue Re: Counting the number of control codes used. - 31/05/03 10:40 PM
You missed a colon : in $regex($1-,/[[:cntrl:]]/g)
oops, yeah, thx
Maybe I'm missing something, but why is it /[[:cntrl:]]/g and not just /[:cntrl:]/g ?
This is how man.txt describes it,

     "Perl supports the POSIX notation for character classes,
     which uses names enclosed by [: and :] within the enclosing
     square brackets."
Ah ok, it's just PCRE/Perl deciding not to follow the POSIX standard for regular expressions...
If you just want to count the number of instances of BURC, the oldskool method is simply: $count($1-,$chr(2),$chr(31),$chr(22),$chr(3))

If you want to get into counting opening but not closing control codes, then a regular expression should be appropriate.

- Raccoon
© mIRC Discussion Forums