tags:

views:

56

answers:

1

I'm trying to parse a text file that has ANSI color sequences in it, e.g.

\e[0;37m

How can I build a regex to match this in Ruby?

+1  A: 

It turns out this works absolutely fine:

def strip_ansi_sequence (str)
  str.gsub(/\e\[[^m]*m/, '')
end
Amy