请问:
<font style="cursor:pointer;" onclick="showDetails('4028c9e5389a84e90138c71e1c290432');" title="IBMHX5服务器">IBMHX5服务器</font></td>
要取出:4028c9e5389a84e90138c71e1c290432
正则表达式该怎么写?
我不会,帮帮忙啊,谢谢。
<font style="cursor:pointer;" onclick="showDetails('4028c9e5389a84e90138c71e1c290432');" title="IBMHX5服务器">IBMHX5服务器</font></td>
要取出:4028c9e5389a84e90138c71e1c290432
正则表达式该怎么写?
我不会,帮帮忙啊,谢谢。
Pattern p = Pattern.compile("<font (\\s|\\S)*?('((\\s|\\S)*?)')(\\s|\\S)*?</font></td>");
Matcher m = p.matcher("<font style=\"cursor:pointer;\" onclick=\"showDetails('4028c9e5389a84e90138c71e1c290432');\" title=\"IBMHX5服务器\">IBMHX5服务器</font></td>");
while(m.find()){
System.out.println("" + m.group(3));
}
}这个应该可以
List<String> imgList = new ArrayList<String>();
String intputStr = "<font style=\"cursor:pointer;\" onclick=\"showDetails('4028c9e5389a84e90138c71e1c290432');\" title=\"IBMHX5服务器\">IBMHX5服务器</font></td> ";
Pattern pattern = Pattern.compile("'(.*)'");
Matcher matcher = pattern.matcher(intputStr);
while (matcher.find()) {
imgList.add(matcher.group(1));
}
System.out.println(imgList);
}[4028c9e5389a84e90138c71e1c290432]
return "4028c9e5389a84e90138c71e1c290432";
}搞定!