UNPKG

tty-strings

Version:

Tools for working with strings displayed in the terminal

22 lines 650 B
/** * Creates a regular expression that matches ANSI escape codes. * * @remarks * This method is modeled off chalk's {@link https://github.com/chalk/ansi-regex|`ansi-regex`} package, * but matches a more comprehensive range of ANSI escape sequences. * * @example * ```ts * import { ansiRegex } from 'tty-strings'; * * '\x1b[32mfoo\x1b[39m'.match(ansiRegex()); * // > ['\x1b[32m', '\x1b[39m'] * ``` * * @param options - Optional options object to specify the global flag. * @returns A new regular expression. */ export default function ansiRegex({ global }?: { global?: boolean; }): RegExp; //# sourceMappingURL=ansiRegex.d.ts.map