Gathering detailed insights and metrics for ansi-regex
Gathering detailed insights and metrics for ansi-regex
Gathering detailed insights and metrics for ansi-regex
Gathering detailed insights and metrics for ansi-regex
has-ansi
Check if a string has ANSI escape codes
@types/ansi-regex
Stub TypeScript definitions entry for ansi-regex, which provides its own types definitions
jees-ansi-regex
Regular expression to handling ANSI escape codes ✨
@puzzle_w/ansi-regex
Regular expression for matching ANSI escape codes
Regular expression for matching ANSI escape codes
npm install ansi-regex
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.7
Supply Chain
81.3
Quality
79
Maintenance
100
Vulnerability
100
License
JavaScript (99.04%)
TypeScript (0.96%)
Total Downloads
32,053,215,670
Last Day
33,049,321
Last Week
151,669,876
Last Month
688,604,651
Last Year
8,351,652,569
188 Stars
57 Commits
79 Forks
17 Watching
4 Branches
12 Contributors
Minified
Minified + Gzipped
Latest Version
6.1.0
Package Id
ansi-regex@6.1.0
Unpacked Size
5.29 kB
Size
2.60 kB
File Count
5
NPM Version
10.6.0
Node Version
18.20.4
Publised On
09 Sept 2024
Cumulative downloads
Total Downloads
Last day
-3.6%
33,049,321
Compared to previous day
Last week
-15.5%
151,669,876
Compared to previous week
Last month
5.2%
688,604,651
Compared to previous month
Last year
19%
8,351,652,569
Compared to previous year
4
Regular expression for matching ANSI escape codes
1npm install ansi-regex
1import ansiRegex from 'ansi-regex'; 2 3ansiRegex().test('\u001B[4mcake\u001B[0m'); 4//=> true 5 6ansiRegex().test('cake'); 7//=> false 8 9'\u001B[4mcake\u001B[0m'.match(ansiRegex()); 10//=> ['\u001B[4m', '\u001B[0m'] 11 12'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); 13//=> ['\u001B[4m'] 14 15'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); 16//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
Returns a regex for matching ANSI escape codes.
Type: object
Type: boolean
Default: false
(Matches any ANSI escape codes in a string)
Match only the first ANSI escape.
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
Stable Version
4
7.5/10
Summary
Inefficient Regular Expression Complexity in chalk/ansi-regex
Affected Versions
>= 3.0.0, < 3.0.1
Patched Versions
3.0.1
7.5/10
Summary
Inefficient Regular Expression Complexity in chalk/ansi-regex
Affected Versions
>= 4.0.0, < 4.1.1
Patched Versions
4.1.1
7.5/10
Summary
Inefficient Regular Expression Complexity in chalk/ansi-regex
Affected Versions
>= 5.0.0, < 5.0.1
Patched Versions
5.0.1
7.5/10
Summary
Inefficient Regular Expression Complexity in chalk/ansi-regex
Affected Versions
>= 6.0.0, < 6.0.1
Patched Versions
6.0.1
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 10/30 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More