Skip to content

Commit 66d3101

Browse files
cjihrigtargos
authored andcommitted
util: improve ansi escape code regex
PR-URL: #40214 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent f4164fa commit 66d3101

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/internal/util/inspect.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ const meta = [
223223
// License: MIT, authors: @sindresorhus, Qix-, arjunmehta and LitoMore
224224
// Matches all ansi escape code sequences in a string
225225
const ansiPattern = '[\\u001B\\u009B][[\\]()#;?]*' +
226-
'(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)' +
226+
'(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*' +
227+
'|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)' +
227228
'|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))';
228229
const ansi = new RegExp(ansiPattern, 'g');
229230

0 commit comments

Comments
 (0)