From 661ba191147b453f3e1c9eb006b4fe1b2455b928 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Fri, 6 Oct 2017 16:17:56 +0100 Subject: [PATCH] utils/misc: strip more with strip_bash_colors Update regex used by strip_bash_colors to match more ANSI escape sequencies. --- devlib/utils/misc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devlib/utils/misc.py b/devlib/utils/misc.py index 8cfd59f..9565f47 100644 --- a/devlib/utils/misc.py +++ b/devlib/utils/misc.py @@ -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)