Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How to lose ANSI color from String

Options
  • 03-03-2016 10:10am
    #1
    Registered Users Posts: 262 ✭✭


    Can be via Java or shell - Im getting outputs like

    [92mourStuff_2a947-user-zk4PaQ [][0m


Comments

  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    What's the text? If you're referring to colour codes, you're presumably missing some escape characters. Is this supposed to read "ourStuff_2a947-user-zk4PaQ"?


  • Registered Users Posts: 1,393 ✭✭✭Inspector Gadget


    StackExchange for the win.

    Basically, they're escape codes, which means they start with the <ESC> character (ASCII 27, Octal 33, Hex 1B) and then have a regex-matchable format.

    The suggestions at the link above should help you (either just drop in the Perl script, or use the regexes offered in Java and/or shell with sed)


Advertisement