agavrilov76 / ExpectIt

Yet another Expect for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Colors filter is buggy

agavrilov76 opened this issue · comments

The removeColors filter does remove color for the following input:

�[01;31m�[KAAA�[m�[K=BBB

It returns:
�[K=BBB

It is reproducible when getting the output of the following command: env | grep A

The fix is to use better regexp to remove the colors:
\x1b[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]

Link: http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed