@nightgrey/ansi
    Preparing search index...

    Variable SIMPLE_REGEXConst

    SIMPLE_REGEX: RegExp = ...

    Simple regular expression for matching basic ANSI escape sequences.

    For a more comprehensive regex, see COMPLEX_REGEX.

    This regex matches only the most common CSI (Control Sequence Introducer) sequences that start with ESC[ followed by numeric parameters and alphabetic final characters.

    Matches:

    • Color codes: \x1b[31m, \x1b[38;5;196m
    • Cursor movement: \x1b[10;5H, \x1b[2A
    • Text formatting: \x1b[1m (bold), \x1b[0m (reset)

    Does NOT match:

    • OSC sequences: \x1b]0;title\x07
    • Complex terminators beyond alphabetic characters
    • Non-CSI escape sequences

    Use cases:

    • Basic text cleaning for display
    • Performance-critical applications
    • Simple terminal output processing

    Performance: Fast due to simple pattern Coverage: ~80-90% of common ANSI sequences

    COMPLEX_REGEX

    const coloredText = "\x1b[31mError:\x1b[0m Something went wrong";
    const cleanText = coloredText.replace(SIMPLE_REGEX, "");
    // Result: "Error: Something went wrong"