public static List getContext(String html) { List resultList = new ArrayList(); Pattern p = Pattern.compile("<p>([^</p>]*)");//匹配<title>开头,</title>结尾的文档 Matcher m = p.matcher(html );//开始编译 while (m.find()) { resultList.add(m.group(1));//获取被匹配的部分 } return resultList; }
List resultList = new ArrayList();
Pattern p = Pattern.compile("<p>([^</p>]*)");//匹配<title>开头,</title>结尾的文档
Matcher m = p.matcher(html );//开始编译
while (m.find()) {
resultList.add(m.group(1));//获取被匹配的部分
}
return resultList;
}