diff --git a/notebook/static/base/js/utils.js b/notebook/static/base/js/utils.js
index b07c73e36..7c6f482c4 100644
--- a/notebook/static/base/js/utils.js
+++ b/notebook/static/base/js/utils.js
@@ -348,7 +348,7 @@ define([
// Strip all ANSI codes that are not color related. Matches
// all ANSI codes that do not end with "m".
- var ignored_re = /(?=(\033\[[\d;=]*[a-ln-zA-Z]{1}))\1(?!m)/g;
+ var ignored_re = /(?=(\033\[[?\d;=]*[a-ln-zA-Z]{1}))\1(?!m)/g;
txt = txt.replace(ignored_re, "");
// color ansi codes
diff --git a/notebook/tests/base/utils.js b/notebook/tests/base/utils.js
index 624983ba2..3000f823a 100644
--- a/notebook/tests/base/utils.js
+++ b/notebook/tests/base/utils.js
@@ -5,6 +5,7 @@ casper.notebook_test(function () {
"\033[0m[\033[33mwarn\033[0m] \033[0m https://some/url/to/a/file.ext\033[0m",
"\033[0m[\033[31merror\033[0m] \033[0m\033[0m",
"\033[0m[\033[31merror\033[0m] \033[0m\teven more text\033[0m",
+ "[?25hBuilding wheels for collected packages: scipy",
"\033[0m[\033[31merror\033[0m] \033[0m\t\tand more more text\033[0m"].join("\n");
var output = [
@@ -13,6 +14,7 @@ casper.notebook_test(function () {
"[warn] https://some/url/to/a/file.ext",
"[error] ",
"[error] \teven more text",
+ "Building wheels for collected packages: scipy",
"[error] \t\tand more more text"].join("\n");
var result = this.evaluate(function (input) {