1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-07 05:30:44 +00:00

utils/misc: strip more with strip_bash_colors

Update regex used by strip_bash_colors to match more ANSI escape
sequencies.
This commit is contained in:
Sergei Trofimov 2017-10-06 16:17:56 +01:00
parent 7e073c1fce
commit 661ba19114

View File

@ -474,8 +474,8 @@ def which(name):
return None
_bash_color_regex = re.compile('\x1b\\[[0-9;]+m')
# This matches most ANSI escape sequences, not just colors
_bash_color_regex = re.compile(r'\x1b\[[0-9;]*[a-zA-Z]')
def strip_bash_colors(text):
return _bash_color_regex.sub('', text)