/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sense.test;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author tenking
*/
public class Html2Text {
/**
* @param args the command line arguments
*/
public static String html2Text(String str){
Pattern pattern = Pattern.compile("<[.[^<]]*>");
Matcher matcher = pattern.matcher(str);
str = matcher.replaceAll("");
return str;
}
public static void main(String[] args) {
String s = new String();
s = "<html><head></head><body><table><tr><td>呵呵,看看HTML标签去掉没有</td></tr></table><img src=/"http::www.nneye.com/"/></body></html>";
System.out.println(html2Text(s));
}
}