Here you can find the source of removeTags(final String source)
public static String removeTags(final String source)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String removeTags(final String source, final String regex) { String modified = new String(source); Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(modified); return matcher.replaceAll(""); }/*from w ww. j ava 2 s. c o m*/ public static String removeTags(final String source) { String modified = removeTags(source, "<(\"[^\"]*\"|'[^']*'|[^'\">])*>"); return replaceHTMLTags(modified); } private static String replaceHTMLTags(final String source) { String modified = new String(source); return modified.replace(" ", " ").replace("<", "<") .replace(">", ">").replace("&", "&") .replace(""", "\"").replace("\n", ""); } }