Android examples for java.util.regex:HTML Pattern
filter Html Tag Deeply by replace < and > using regular expression
import android.text.TextUtils; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static String filterHtmlTagDeeply(String inputString) { String htmlStr = filterHtmlTag(inputString).replace(" ", " "); Pattern pHtml;//from w w w . j a v a 2s . co m Matcher mHtml; try { String regExHtml = "<[^>]+>"; pHtml = Pattern.compile(regExHtml, Pattern.CASE_INSENSITIVE); mHtml = pHtml.matcher(htmlStr); htmlStr = mHtml.replaceAll(""); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); } return htmlStr; } }