Back to Explore

chalk/ansi-regex

GitHub
2 watchersOpen source

Last release:

ansi-regex provides a function that returns a regular expression for matching ANSI escape codes in strings, useful for detecting and extracting terminal formatting sequences. It can test whether a string contains ANSI codes, match all codes or only the first (via an options flag), and extract the matched escape sequences.

Project status

  • Actively maintained: Evidence suggests ongoing activity (last upstream push on 2026-02-18), with recent tagged updates in 2025 (v6.2.0 on 2025-08-17, v6.2.2 on 2025-09-08), indicating the project is not dormant as of today (2026-06-09).
  • Update cadence: The most recent tagged updates came close together in 2025 (about a month apart). After v6.2.2 (2025-09-08), there is a gap before the next observed upstream push (2026-02-18), with no additional tagged updates shown since then.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v6.2.2

    v6.2.2 is published as a follow-up release intended to fix a vulnerability reported for v6.2.1. Based on the provided diff, the only change present is a package.json version bump.

    Security
  • v6.2.0

    v6.2.0 extends ansi-regex to support colon-separated parameters in ANSI control sequences (for example, SGR 38:2 and related variants). The implementation also significantly restructures the underlying regular expression for OSC (string) and CSI (control sequence) matching.

    Features
  • v6.1.0

    v6.1.0 updates ansi-regex to recognize additional ANSI escape sequences, including cursor save/restore, and improves OSC termination handling for all valid ST (string terminator) characters. In addition to the regex behavior changes, the release contains major packaging and TypeScript declaration changes that are not mentioned in the release notes.

    Breaking
  • v5.0.1

    v5.0.1 is a backport of the ReDoS fix from v6.0.1. The release notes state it fixes CVE-2021-3807 by adjusting the ANSI escape matching regex used by the package.

    Security
  • v6.0.1

    Release v6.0.1 updates the core ANSI escape code matching regex in index.js. The release notes describe a ReDoS mitigation for CVE-2021-3807, but the code diff shows the regex logic was materially restructured rather than only tuned for performance.

    Security
  • v6.0.0

    Release v6.0.0 makes ansi-regex a pure ESM package targeting Node.js >= 12, aligning runtime, packaging, tests, and docs with ESM import syntax. The diff also includes TypeScript declaration restructuring and a package.json exports map that can change how subpath imports resolve.

    Breaking
  • v5.0.0

    This release bumps the minimum supported Node.js version to 8 and introduces a TypeScript definition file for ansi-regex. The code changes also include modernized parameter handling and updated test and development tooling.

    BreakingFeatures
  • v4.1.0

    Release v4.1.0 adds improved support for additional ANSI escape codes, specifically those related to hyperlinks (links). This broadens what patterns the library can recognize compared to v4.0.0.

    Features