日期:2014-05-17 浏览次数:20764 次
public class Test { public static void main(String args[]) throws Exception{ String html = "<tr><td>aa</td></tr><tr><td>bb</td></tr><tr><td>cc</td></tr>"; Matcher m = Pattern.compile("<tr>.+?</tr>").matcher(html); int c = 1; while(m.find()){ if(c++ == 3){ System.out.println(m.group(0)); } } } }