mIRC Home    About    Download    Register    News    Help

Print Thread
Counting the number of control codes used. #27291 31/05/03 06:26 PM
Joined: Mar 2003
Posts: 18
M
Maveric Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Mar 2003
Posts: 18
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.

Re: Counting the number of control codes used. #27292 31/05/03 06:34 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
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-)))

Re: Counting the number of control codes used. #27293 31/05/03 10:40 PM
Joined: Dec 2002
Posts: 699
N
Nimue Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
You missed a colon : in $regex($1-,/[[:cntrl:]]/g)

Re: Counting the number of control codes used. #27294 31/05/03 10:52 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
oops, yeah, thx

Re: Counting the number of control codes used. #27295 31/05/03 11:18 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Maybe I'm missing something, but why is it /[[:cntrl:]]/g and not just /[:cntrl:]/g ?

Re: Counting the number of control codes used. #27296 31/05/03 11:35 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
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."

Re: Counting the number of control codes used. #27297 01/06/03 12:44 AM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Ah ok, it's just PCRE/Perl deciding not to follow the POSIX standard for regular expressions...

Re: Counting the number of control codes used. #27298 01/06/03 03:13 AM
Joined: Feb 2003
Posts: 2,785
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,785
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!