Crate parse_ansi[][src]

Parse ANSI escape codes (colors, underlines, etc.)

extern crate parse_ansi;

let ansi_text = b"Hello, \x1b[31;4mworld\x1b[0m!";
let parsed: Vec<_> = parse_ansi::parse_bytes(ansi_text)
    .map(|m| (m.start(), m.end(), m.as_bytes()))
    .collect();
assert_eq!(
    parsed,
    vec![
        ( 7, 14, b"\x1b[31;4m" as &[u8]),
        (19, 23, b"\x1b[0m"),
    ],
);

Structs

ANSI_REGEX

Constants

ANSI_RE

Functions

parse_bytes

Parses ANSI escape codes from the given text, returning an Iterator<Item = Match>.