Ramakrishna
Ramakrishna

Reputation: 426

how to remove all junk characters from a string in java

I have a string like below

String s="[01;31m[KINACTIVE[m[K=-1";

i need to remove all those junk characters [01;31m[ .

my actual output is INACTIVE=-1 but with this some junks are added.how to remove using java.

Upvotes: 0

Views: 3786

Answers (1)

Shakeel
Shakeel

Reputation: 1059

What you're seeing there appear to be ANSI escape codes and they're used to format console output, or at least that's the general idea.

I've used the top regular expression here before to remove the ANSI codes from Travis CI logs.

Upvotes: 4

Related Questions