use parser instead of regexp to remove ansi escape codes