Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {

    public static String filterHtml(String html) {
        Pattern pattern = Pattern.compile("<style[^>]*?>[\\D\\d]*?<\\/style>");
        Matcher matcher = pattern.matcher(html);
        String htmlStr = matcher.replaceAll("");
        pattern = Pattern.compile("<[^>]+>");
        String filterStr = pattern.matcher(htmlStr).replaceAll("");
        filterStr = filterStr.replace("&nbsp;", "");
        filterStr = filterStr.replace("&#13;", "");
        return filterStr.trim();
    }
}