remove HTML Tag - Java java.lang

Java examples for java.lang:String HTML

Description

remove HTML Tag

Demo Code

/**// w  w w  .j  av  a2s  . c  o  m
 * Copyright (c) 2014, Mingle. All rights reserved.
 */
//package com.java2s;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static String removeHTMLTag(String in) {
        String regular = "<[^>]+>";

        Pattern pattern = Pattern.compile(regular);
        Matcher matcher = pattern.matcher(in);

        return matcher.replaceAll("");
    }
}

Related Tutorials