81,092
社区成员
发帖
与我相关
我的任务
分享
// 三个空格
String te = "a bc";
Matcher m = Pattern.compile(" ( +)").matcher(te);
// 只匹配找到的第一个
if(m.find())
System.out.println(m.group(1))
Pattern pattern = Pattern.compile("(?<= ) +");
Matcher matcher = pattern.matcher(" , ");
while (matcher.find()) {
System.out.println("[" + matcher.group() + "]");
}