mIRC Home    About    Download    Register    News    Help

Print Thread
Stripping specific colour codes #187254 02/10/07 05:14 AM
Joined: Jun 2004
Posts: 25
Q
Quia Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2004
Posts: 25
I've been trying to remove ctr+k#,# colour codes without changing ctr+k# codes, but I can't figure out how to do it. One problem being that I need to detect ##,## ##,# #,## and #,# to catch all of them, so I can't just $remove the first 4 characters, and I'd also like to remove it no matter where in the string it is.

Any ideas?

Re: Stripping specific colour codes [Re: Quia] #187256 02/10/07 06:17 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
//echo -a $strip(My colored string,c) will strip all colors out of string

while $remove($1-,$+($chr(3),##)) will also do the same


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Stripping specific colour codes [Re: Quia] #187263 02/10/07 11:50 AM
Joined: Jul 2006
Posts: 107
L
LonDart Offline
Vogon poet
Offline
Vogon poet
L
Joined: Jul 2006
Posts: 107
It seems you only want to remove color codes that indicate a background color, and retain those that only color the text.

For that case, this worked in my limited testing:
Code:
alias nobkgd {
  $iif($isid,return,echo -a) $regsubex($1-,/\x03\d?\d\x2c\d?\d/g,$chr(32))
}

\xo3 is hex code 3, the only thing I tried that caught Ctrl+k.
Likewise, \x2c is hex code for comma. mirc doesn't like literal commas, even inside regex.

Last edited by LonDart; 02/10/07 11:53 AM.

LonDart