Pattern p=Pattern.compile("<li><a.*?href=(.+?)>(.+?)</a><span>(.+?)</span></li>");
Matcher m=p.matcher(str);
while(m.find()){
System.out.println(m.group(2));
}
这样打印出来有很多个数据,我只要获取第一个数据,怎么办啊
Matcher m=p.matcher(str);
while(m.find()){
System.out.println(m.group(2));
}
这样打印出来有很多个数据,我只要获取第一个数据,怎么办啊
while(m.find()){
System.out.println(m.group(2));break;
}