+26
-16
lines changedFilter options
+26
-16
lines changed Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
1
1
export default function ansiRegex({onlyFirst = false} = {}) {
2
+
// Valid string terminator sequences are BEL, ESC\, and 0x9c
3
+
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
2
4
const pattern = [
3
-
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
4
-
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
5
+
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
6
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
5
7
].join('|');
6
8
7
9
return new RegExp(pattern, onlyFirst ? undefined : 'g');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "ansi-regex",
3
-
"version": "6.0.1",
3
+
"version": "6.1.0",
4
4
"description": "Regular expression for matching ANSI escape codes",
5
5
"license": "MIT",
6
6
"repository": "chalk/ansi-regex",
@@ -12,6 +12,8 @@
12
12
},
13
13
"type": "module",
14
14
"exports": "./index.js",
15
+
"types": "./index.d.ts",
16
+
"sideEffects": false,
15
17
"engines": {
16
18
"node": ">=12"
17
19
},
@@ -51,8 +53,9 @@
51
53
"pattern"
52
54
],
53
55
"devDependencies": {
56
+
"ansi-escapes": "^5.0.0",
54
57
"ava": "^3.15.0",
55
-
"tsd": "^0.14.0",
56
-
"xo": "^0.38.2"
58
+
"tsd": "^0.21.0",
59
+
"xo": "^0.54.2"
57
60
}
58
61
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
1
1
export default function ansiRegex({onlyFirst = false} = {}) {
2
+
// Valid string terminator sequences are BEL, ESC\, and 0x9c
3
+
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
2
4
const pattern = [
3
-
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
4
-
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
5
+
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
6
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
5
7
].join('|');
6
8
7
9
return new RegExp(pattern, onlyFirst ? undefined : 'g');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "ansi-regex",
3
-
"version": "6.0.1",
3
+
"version": "6.1.0",
4
4
"description": "Regular expression for matching ANSI escape codes",
5
5
"license": "MIT",
6
6
"repository": "chalk/ansi-regex",
@@ -12,6 +12,8 @@
12
12
},
13
13
"type": "module",
14
14
"exports": "./index.js",
15
+
"types": "./index.d.ts",
16
+
"sideEffects": false,
15
17
"engines": {
16
18
"node": ">=12"
17
19
},
@@ -51,8 +53,9 @@
51
53
"pattern"
52
54
],
53
55
"devDependencies": {
56
+
"ansi-escapes": "^5.0.0",
54
57
"ava": "^3.15.0",
55
-
"tsd": "^0.14.0",
56
-
"xo": "^0.38.2"
58
+
"tsd": "^0.21.0",
59
+
"xo": "^0.54.2"
57
60
}
58
61
}
Original file line number Diff line number Diff line change
@@ -2977,9 +2977,9 @@
2977
2977
}
2978
2978
},
2979
2979
"node_modules/@isaacs/cliui/node_modules/ansi-regex": {
2980
-
"version": "6.0.1",
2981
-
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
2982
-
"integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
2980
+
"version": "6.1.0",
2981
+
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz",
2982
+
"integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",
2983
2983
"inBundle": true,
2984
2984
"license": "MIT",
2985
2985
"engines": {
@@ -18157,9 +18157,9 @@
18157
18157
}
18158
18158
},
18159
18159
"node_modules/wrap-ansi/node_modules/ansi-regex": {
18160
-
"version": "6.0.1",
18161
-
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
18162
-
"integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
18160
+
"version": "6.1.0",
18161
+
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz",
18162
+
"integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",
18163
18163
"inBundle": true,
18164
18164
"license": "MIT",
18165
18165
"engines": {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4