mIRC Home    About    Download    Register    News    Help

Print Thread
M
Maveric
Maveric
M
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.

S
ScatMan
ScatMan
S
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-)))

Joined: Dec 2002
Posts: 698
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 698
You missed a colon : in $regex($1-,/[[:cntrl:]]/g)

S
ScatMan
ScatMan
S
oops, yeah, thx

C
codemastr
codemastr
C
Maybe I'm missing something, but why is it /[[:cntrl:]]/g and not just /[:cntrl:]/g ?

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
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."

C
codemastr
codemastr
C
Ah ok, it's just PCRE/Perl deciding not to follow the POSIX standard for regular expressions...

Joined: Feb 2003
Posts: 2,737
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,737
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


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard