Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 3
    This regex strips too much (foo\e[1m(1m = { becomes foo = { instead of foo(m = {), replacing . by [0-9;] is more accurate. Commented Dec 30, 2013 at 15:14
  • Replace .\{1,5\} with [^m]\{1,5\} for that - but also note that this even then still only removes "graphics rendition" codes (those that end in an m) - basically color, reverse, bold and italics styles (where applicable). Commented Aug 23, 2015 at 14:26
  • This doesn't remove \x1b(B (included in rusts color output) Commented Nov 11, 2016 at 13:11
  • 2
    Why is it \x1b and not \033? Commented Aug 24, 2017 at 15:21
  • It might be \u001b instead of \x1b Commented May 23, 2019 at 12:03