62,623
社区成员
发帖
与我相关
我的任务
分享
String str = "aaavbvv流c行ddff飾zzz8品584";
String regex = "&#\\d{5};";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
if(m.find()){
for (int i = 1; i <= m.groupCount(); i++) {
System.out.println(m.group(i));
}
}
String str = "aaavbvv流c行ddff飾zzz8品584";
String regex = "&#(\\d{5});";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
while(m.find()){
String s=m.group();
System.out.println(s);
str=str.replaceAll("&#"+s+";","");
}
}