string operations (ctrl characters)

Richard Brodie R.Brodie at rl.ac.uk
Thu Aug 16 07:28:12 EDT 2001


"Hans Nowak" <hnowak at cuci.nl> wrote in message
news:mailman.997950925.22550.python-list at python.org...

> You don't *need* regexen for this, though. One approach could be, scanning the
> string for "acceptable" characters, and replacing anything else with some
> default character, or removing it.

That would not be best in this case, as he is seeing ANSI escape sequences.
You often see things like <ESC>[23m ; there is a general syntax for them so
a good emulator should be able to parse and ignore unrecognised codes.
Unfortunately, there is no obvious "end escape sequence" delimiter, so its
not entirely trivial.





More information about the Python-list mailing list