mirror of https://github.com/nodejs/node.git
util: improve ansi escape code regex
PR-URL: https://github.com/nodejs/node/pull/40214 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
396b14b6c6
commit
606bb52159
|
@ -223,7 +223,8 @@ const meta = [
|
|||
// License: MIT, authors: @sindresorhus, Qix-, arjunmehta and LitoMore
|
||||
// Matches all ansi escape code sequences in a string
|
||||
const ansiPattern = '[\\u001B\\u009B][[\\]()#;?]*' +
|
||||
'(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)' +
|
||||
'(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*' +
|
||||
'|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)' +
|
||||
'|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))';
|
||||
const ansi = new RegExp(ansiPattern, 'g');
|
||||
|
||||
|
|
Loading…
Reference in New Issue