|
The Raven Magician
Joined: 13 Oct 2000 Posts: 463
|
Posted: Tue May 25, 2004 6:29 pm
Matching ANSI Escape Codes |
I'm trying to manually parse the colors of various lines. Using an ANSI trigger, I grab the contents of a multi-colored line into a variable, escape sequences and all. What I'm trying to do is iterate through that line, looking for escape sequences and finding out all the colors on that line.
Unfortunately, the escape character is causing problems... I cannot search for it. You can't have the escape code inside a search expression. Has anyone else tried to process ANSI color sequences manually? Do they have any tips? |
|
|
|
The Raven Magician
Joined: 13 Oct 2000 Posts: 463
|
Posted: Tue May 25, 2004 7:41 pm |
I did a workaround... rather than strictly matching the escape sequence, I matched '.[[0-9;]+m'... in other words, I ignore the escape character at the binning, just matching for any character (.), and finding the rest of the normal characters in the sequence (ex '[1;34m'). I'd rather strictly match the escape character, but this should be good enough for now.
|
|
|
|
Insomniac Wanderer
Joined: 25 Mar 2004 Posts: 78 Location: United Kingdom
|
Posted: Tue May 25, 2004 10:13 pm |
%e is the token for the escape character (the little square). Also ensure the 'ANSI Trigger' option is enabled on your trigger.
|
|
|
|
|
|