java正则匹配字符串最外层{}里的内容,包含{}
String s = "start {sffff''{adfaw3ea}wfewrfwef----}";
String regex = "(?<=\\{).*(?=\\})";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(s);
while (matcher.find()) {
System.out.println(matcher.group(0));
}
输出:{sffff''{adfaw3ea}wfewrfwef----}