mIRC Home    About    Download    Register    News    Help

Print Thread
#64927 23/12/03 02:37 AM
Joined: Dec 2003
Posts: 3
K
kharma Offline OP
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Dec 2003
Posts: 3
Is there a way for regex to pick up text codes (bold, underline, colour, reverse) in an on *:TEXT: event? For example, the following works:
Code:
on *:TEXT:/(a|b|c|d)/iS:#: /echo -a bla
But if I replace a,b,c and d with the codes for bold, underline, colour and reverse then the event no longer fires. I tried to prefix the characters with \ ie:
Code:
on *:TEXT:/(\|\|\|\)/iS:#: /echo -a bla
but this does not appear to work. Am I doing something wrong? Could I possibly embed a $chr() inside the match?
Code:
on *:TEXT:/($chr(2)|$chr(31)|$chr(22)|$chr(3))/iS:#: /echo -a bla


Am I missing something very obvious? Feel free to make a fool of me smile.

Thanks.

#64928 23/12/03 03:03 AM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
To use regex in the matchtext area you need to use the $ prefix. You also don't need/want the iS.

#64929 23/12/03 03:07 AM
Joined: Dec 2003
Posts: 3
K
kharma Offline OP
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Dec 2003
Posts: 3
Aha thankyou. I did have the $ prefix, but I didn't realise that iS was causing me the problems.

Thanks again.

#64930 23/12/03 03:09 AM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
It's because you're using the S modifier, which strips all control codes from the text when it performs the expression match. Also your events aren't using the $ prefix so they're not even performing regular expression matches, but I assume that was simply an oversight when you posted your code here.

EDIT: Looks like I took too long replying.

Last edited by starbucks_mafia; 23/12/03 03:12 AM.

Spelling mistakes, grammatical errors, and stupid comments are intentional.

Link Copied to Clipboard