VT filter regex breakdown

These below regular expressions are used to filter and match the VT sequences found in either the text input or the file input. The master regular expression is found by clicking on the code file button shown below.

Regex Breakdown

CSI escape sequences

CSI escape sequences are the most common VT sequences supported by terminal emulators available through multiple platforms, like the improved Windows 10 terminal, xterm, etc. One of the major CSI sequences is the color setting, which lets you set the background and the foreground color of the text.

  • (\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]

OSC escape sequences

OSC escape sequences are Operating System Command sequences that are implemented mostly by xterm. You can set the title of the terminal in one of the OSC escape sequences, which is "ESC ]0;Title BEL".

  • (\x9D|\x1B\]).+(\x07|\x9c)

ESC escape sequences

ESC escape sequences are widely used for terminal manipulation, like saving the cursor, application keypad, and more.

  • \x1b [F-Nf-n]
  • \x1b#[3-8]
  • \x1b%[@Gg]
  • \x1b[()*+][A-Za-z0-9=`<>]
  • \x1b[()*+]\"[>4?]
  • \x1b[()*+]%[0-6=]
  • \x1b[()*+]&[4-5]
  • \x1b[-.\/][ABFHLM]
  • \x1b[6-9Fcl-o=>\|\}~]

APC VT sequences

Application Program Command (APC) VT sequences are used as an opening delimiter for application program use, such as those from some Kermit implementations.

  • (\x9f|\x1b_).+\x9c

DCS VT sequences

Device Control VT sequences are used to provide support for user-defined keys, request status string, etc.

  • (\x90|\x1bP).+\x9c

PM VT sequences

Privacy Message VT sequences are used to provide privacy discipline. This is used by some Kermit implementations.

  • (\x9e|\x1b\^).+\x9c

C1 VT sequences

C1 VT sequences are used in text by computer systems that use ASCII and its derivatives.

  • \x1b[DEHMNOVWXYZ78]