Java - Write code to remove Html Tag using regex

Requirements

Write code to remove Html Tag using regex

Demo

//package com.book2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] argv) {
        String html = "<b>ook2s.com";
        System.out.println(removeHtmlTag(html));
    }//from   w ww. j a v  a  2 s  .  c o  m

    public static String removeHtmlTag(String html) {
        String regEx_html = "<[^>]+>";
        Pattern p_html = Pattern.compile(regEx_html,
                Pattern.CASE_INSENSITIVE);
        Matcher m_html = p_html.matcher(html);
        html = m_html.replaceAll(""); 

        return html.trim(); 
    }
}