Double color code negation. - 27/03/03 08:37 PM
I am trying to script a quick alias that removes doubled and unneeded color codes out some given text.
Some of the situations such as double bolds double underlines and double reverses are simple to just do a remove on. Double color codes so long as the first color code is blank is also pretty easy.
alias ddc { return $replace($remove($1-,$chr(2) $+ $chr(2)), $chr(3) $+ $chr(3), $chr(3)) }
The problem is I often use quick alias to change the color of specific text and the aliases close the color codes just to have them reopened.
I've tried my hand a bit at picking apart the color codes with regex but it quickly becomes apparent that there are too many combinations to deal with them all very nicely.
B = bold char
/B(\s|[:cntrl:])*B/ replace with B*$regml
Not sure, but has anybody else done something close there to and care to enlighten me on some of the finer points.
Some of the situations such as double bolds double underlines and double reverses are simple to just do a remove on. Double color codes so long as the first color code is blank is also pretty easy.
alias ddc { return $replace($remove($1-,$chr(2) $+ $chr(2)), $chr(3) $+ $chr(3), $chr(3)) }
The problem is I often use quick alias to change the color of specific text and the aliases close the color codes just to have them reopened.
I've tried my hand a bit at picking apart the color codes with regex but it quickly becomes apparent that there are too many combinations to deal with them all very nicely.
B = bold char
/B(\s|[:cntrl:])*B/ replace with B*$regml
Not sure, but has anybody else done something close there to and care to enlighten me on some of the finer points.