Here you can find the source of removeAllHtmlTag(String str)
public static String removeAllHtmlTag(String str)
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final String REGULAR_HTML_TAG = "<([^>]*)>"; public static String removeAllHtmlTag(String str) { Pattern pattern = Pattern.compile(REGULAR_HTML_TAG); Matcher matcher = pattern.matcher(str); StringBuffer sb = new StringBuffer(); boolean result1 = matcher.find(); while (result1) { matcher.appendReplacement(sb, ""); result1 = matcher.find();// w w w . jav a2s .co m } matcher.appendTail(sb); return sb.toString(); } }