public static String getonerow(String allLine,String myfind)
{
Pattern pattern = Pattern.compile("
.*?
");
Matcher matcher = pattern.matcher(allLine);
while(matcher.find()) {
String myval = matcher.group();
int npos=myval.indexOf(myfind);
if(npos>=0)
{
npos = myval.indexOf("");
if(npos>0)
{
String content = myval.substring(npos,myval.length());
content=content.replaceAll("?[^>]+>",""); //剔出了的标签
content=content.replace(" ","");
content=content.replace(".","");
content=content.replace("\"","‘");
content=content.replace("'","‘");
content=content.replaceAll("\\s*|\t|\r|\n","");//去除字符串中的空格,回车,换行符,制表符
return content;
}
}
}
return "";
}
这仅仅是压缩html的一个模糊概念,以上仅供参考