【www.gdgbn.com--php函数】


去除html标记

pattern pattern = pattern.compile("<.+?>", pattern.dotall);
matcher matcher = pattern.matcher("主页");
string string = matcher.replaceall("");
system.out.println(string);

查找html中对应条件字符串

pattern pattern = pattern.compile("href="(.+?)"");
matcher matcher = pattern.matcher("主页");
if(matcher.find())
system.out.println(matcher.group(1));
}

 

本文来源:http://www.gdgbn.com/jiaocheng/26983/