日期:2014-05-19 浏览次数:20791 次
public static void main(String[] args) throws Exception { String str = "<td class=\"pane\">63</td><td class=\"pane\"><a href=\"HIGH\">1</a></td><td class=\"pane\"><a href=\"NORMAL\">62</a></td>"; Matcher m = Pattern.compile("<td.*?>.*?([0-9]+).*?</td>").matcher(str); while(m.find()){ System.out.println(m.group(1)); } }
------解决方案--------------------
String ss = "<td class>63</td>";
Pattern p = Pattern.compile("\\>(\\d+)\\<");
Matcher m = p.matcher(ss);
while(m.find()){
System.out.println(m.group(1));
}
简单例子,楼主可以自己酌情修改.