50,543
社区成员
发帖
与我相关
我的任务
分享
String str = "<a class=\"title\" tabindex=\"1\" href=\"任意字符串\">任意字符串2</a>";
Pattern p = Pattern.compile("<a class=\"title\" tabindex=\"1\" href=\"(.*)\">(.*)</a>");
Matcher m = p.matcher(str);
if(m.find()){
System.out.println(m.group(1));
System.out.println(m.group(2));
}
public static void main(String[] args) {
String str = "<a class=\"title\" 任意字符串1>任意字符串2</a>";
Pattern p = Pattern.compile("<a class=\"title\" (.*)>(.*)</a>");
Matcher m = p.matcher(str);
if(m.find()){
System.out.println(m.group(1));
System.out.println(m.group(2));
}
}