Regular Expressions 101

Community Patterns

Strip ANSI CSI

0

Regular Expression
ECMAScript (JavaScript)

/
((?:\\033|\e|\\x1B|\\x1b){1}(?:\[(?:=|\?|[0-9]*)[0-9]*[a-gA-GnmsuJKhlHL]{0,1}(?:(?:\;[0-9]*)*m){0,1}))
/
g

Description

Use control_sequence_filter group to find and remove ANSI CSI codes. Not tested thoroughly. Only for the task that was necessary for me

Submitted by Leonards Elksnis - a year ago (Last modified a year ago)