Site Tools


# $EPIC: stripcrap.txt,v 1.2 2006/08/20 16:57:01 sthalik Exp $


$stripcrap(<mangle-types> <text>)


  • If the <mangle-types> argument is omitted the empty string is returned.
  • If the <text> argument is omitted the empty string is returned.
  • <mangle-types> is parsed in the same way that /SET MANGLE_INBOUND is:
  • No spaces are allowed; separate each option with commas.
  • The effect is cumulative and are parsed left to right.
  • ALL_OFF removes ALL_OFF characters (^O)
  • -ALL_OFF does not remove ALL_OFF characters
  • ALL removes everything except escapes (including ANSI)
    • -ALL does not remove anything.
    • ANSI converts ANSI escape sequences into safe equivalents.
  • -ANSI does not convert ANSI escape sequences into safe equivalents.
  • BLINK removes BLINK characters (^F)
  • -BLINK does not remove BLINK characters
  • BOLD removes BOLD characters (^B)
  • -BOLD does not remove BOLD characters
  • COLOR removes COLOR sequences (^C)
  • -COLOR does not remove COLOR sequences
  • ESCAPE converts ESCAPE chars (^[) into a reverse left-bracket.
  • -ESCAPE does not convert ESCAPE chars into a reverse left-bracket.
  • ND_SPACE removes non-destructive spaces (^S)
  • -ND_SPACE does not remove non-destructive spaces
  • NONE is the same as -ALL – it does not remove anything.
  • REVERSE removes REVERSE characters (^R)
  • -REVERSE does not remove REVERSE characters.
  • ROM_CHAR removes ROM_CHAR characters (^P)
  • -ROM_CHAR does not remove ROM_CHAR characters.
  • UNDERLINE removes UNDERLINE characters (^_)
  • -UNDERLINE does not remove UNDERLINE characters.
  • The return value is <text> mangled in the way specified by <mangle-types>.


Sometimes, you just don't want to see all of that crap in your output. This is how you can filter it out. Some people like to filter out before they send to a log file since it can be hard to read a log file with these display attributes in them.


  • $stripcrap(ALL $*) converts all ESCAPE sequences to “safe” equivalents and removes all unsafe ones entirely; it removes all BOLD, BLINK, COLOR (^C), ND_SPACE, REVERSE, ROM_CHAR, UNDERLINE, and ALL_OFF characters from $* after doing the conversion.
  • $stripcrap(ALL,-COLOR $*) same as above, but ^C color sequences are not removed from $*.
  • $stripcrap(COLOR $*) removes ^C color sequences from $*, but does not remove anything else INCLUDING ANSI escape sequences that may change the color!
  • $stripcrap(ANSI,COLOR $*) converts all ANSI escape sequences into “safe” equivalents and removes unsafe ones entirely; and removes all COLOR sequences, including those that were converted.


The input text, mangled in the way you like.

stripcrap.txt · Last modified: 2006/08/29 16:08 by