In this example we will show how to trim the html tags from a string with regular expressions.
Source Code
package com.beginner.examples;
public class RemoveHtmlTags {
public static void main(String[] args) {
String htmlStr = "
This is a string with an Html tag”; //Using regular expressions String str = htmlStr.replaceAll(“\”, “”); System.out.println(str); } }
Output:
This is a string with an Html tag