-2

I have a string called

String MT="Mike<a anystring>anystring2</a anystring3>Tyson";

I want to replace it and get

MT="Mike Tyson";

(I want to use string replace function in java)

2
  • 6
    Welcome to StackOverflow :) Have you tried anything yet? Commented Nov 17, 2014 at 10:41
  • 2
    possible duplicate of Regex to strip HTML tags Commented Nov 17, 2014 at 10:43

1 Answer 1

0

This will work for you

 public static void main (String[] args) throws java.lang.Exception
        {
            String MT="Mike<a anystring>anystring2</a anystring3>Tyson";
            String stripped = MT.replaceAll("<[^*]*>", " ");
            System.out.println(stripped);
        }

Reference https://stackoverflow.com/a/4075756/876739

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.