62,623
社区成员
发帖
与我相关
我的任务
分享public static void main(String[] args) {
Pattern p = Pattern.compile("watch\\?v=.*\"\\s* rel=");
String s = "上面的字符";
Matcher match = p.matcher(s);
if ( match.find() ) {
System.out.println(match.group(0));
System.out.println(match.group(1));
}
}
Pattern p=Pattern.compile("(?<=watch\\?v=)(\\w)*(?=\")");
Matcher m=p.matcher(sql);
String re="";
while(m.find()){
re+=m.group()+'\n';
}
public static void main(String[] args) {
String s = "<a href=\"/watch?v=o6sdfIyVM\" rel=\"nofollow\" onclick=\"_hbLink('ReR <a href=\"/watch?v=o328djdVb\" rel=\"nofollow\" onclic <a href=\"/watch?v=sdfgVa0FIyVs\" rel=\"nofollow\" onclick=\"_hbLink('ReR <a href=\"/watch?v=38dkj0FIydM\" rel=\"nofollow\" onclic";
Pattern p = Pattern.compile("watch\\?v=(.*?)\"");
Matcher match = p.matcher(s);
while ( match.find() ) {
// System.out.println(match.group(0));
System.out.println(match.group(1));
}
}