2019-06-25 23:07:35 +00:00
|
|
|
import re
|
|
|
|
def escape_ANSI(line):
|
|
|
|
'''
|
|
|
|
Remove ANSI escape codes from a string with regex
|
|
|
|
|
2019-06-26 20:13:36 +00:00
|
|
|
adapted from: https://stackoverflow.com/a/38662876 by user https://stackoverflow.com/users/802365/%c3%89douard-lopez
|
2019-06-25 23:07:35 +00:00
|
|
|
cc-by-sa-3 license https://creativecommons.org/licenses/by-sa/3.0/
|
|
|
|
'''
|
|
|
|
ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]')
|
2019-08-09 20:41:27 +00:00
|
|
|
return ansi_escape.sub('', line)
|