Topic: matcher.find()问题

  Print this page

1.matcher.find()问题 Copy to clipboard
Posted by: mp5lam
Posted on: 2006-04-13 16:13

如果能找到结果的话就很快出来,但是找不到的话程序就没任何东西返回。
我试过在比较短的string里找还是没问题的,但是我要在html code找配对就出问题了,请问有没好的解决方法?
      Pattern pattern=Pattern.compile(".*(<table.+?Last.+?</table>)");
Matcher matcher=pattern.matcher(htmlStr);
if (matcher.find()) {
String table= matcher.group(1);
pattern=Pattern.compile("<span[^>]+>([0-9.%,]+?|N/A)</span>");
matcher=pattern.matcher(table);

while (matcher.find())
System.out.println(matcher.group(1));
} else {
System.out.println("No match found.");
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923