0

How can we replace all the string of a sentence that start from <\ and end >

Is there any way available for this.

for now i am replacing each word manually.

example : -

test = test.replace("</tr>", "");
        test = test.replace("</html>", "");
Java_Alert
  • 1,159
  • 6
  • 24
  • 50

1 Answers1

1

You can use the .replaceAll method.

From the java docs:

Replaces each substring of this string that matches the given regular expression with the given replacement.

Java code should be:

test.replaceAll("<\\/\\w+>");
user184994
  • 17,791
  • 1
  • 46
  • 52