# Matches an ANSI cursor control \e\[(?> (?6n) # 6n will request the cursor position | (?(?\d+)\;(?\d+)R) # A Device Status Report will return CursorPosition in the form ; R | (?(?\d+)A) # Cursor Up is a digit followed by A | (?(?\d+)B) # Cursor Down is a digit followed by B | (?(?\d+)C) # Cursor Forward is a digit followed by C | (?(?\d+)D) # Cursor Back is a digit followed by D | (?(?\d+)E) # Cursor Next Line is a digit followed by E | (?(?\d+)F) # Cursor Next Line is a digit followed by F | (?(?\d+)G) # Cursor Absolute Position is a digit followed by G | (?(?\d{0,})\;(?\d{0,})H) # Cursor Positions are two optional digits, separated by semicolon, ending with H | (?(?\d+)S) # Scroll Up is a digit followed by S | (?(?\d+)T) # Scroll Down is a digit followed by T | (?25h) # Cursors can be hidden with 25h | (?25l) # Cursors can be hidden with 25l )