Remove Html Tag by regex - Android java.util.regex

Android examples for java.util.regex:HTML Pattern

Description

Remove Html Tag by regex

Demo Code


//package com.java2s;

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

public class Main {

    static final Pattern patternHtml = Pattern.compile("<.+?>");

    public static String RemoveHtmlTag(String html) {
        Matcher m = patternHtml.matcher(html);
        while (m.find()) {
            html = m.replaceAll("");
        }/* w  w w . ja va 2  s  . c o  m*/
        return html;
    }
}

Related Tutorials