public class test { /** * @title: main * @description: * @param args * @author * @date 2016年2月17日 * 1、去掉字符串中所有的标签,获取纯文本内容 * 2、获取html节点中img的src路径 */ public static void main(string[] args) { string html = 12132第一串字符
这是第二窜字符
; pattern p = pattern.compile(]+src\\s*=\\s*['\]([^'\]+)['\][^>]*>); matcher m = p.matcher(html); list srcs = new arraylist(); while(m.find()){ srcs.add(m.group(1)); } string regex = ]*>; string str = html.replaceall(regex, ); system.out.println(str+\n+srcs.get(0)); }}