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?
It turns out this works absolutely fine:
def strip_ansi_sequence (str)
str.gsub(/\e\[[^m]*m/, '')
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With