50,530
社区成员
发帖
与我相关
我的任务
分享
String s = "vlsdfjs;lfasal;fjdslfjsdalkfjsadlk{{内容1}yyy{内容2}}xxx{{内容1}zzz{内容3}}aaa{{内容1}}aa{{内容1}}aa{{内容1}}adsfasdfsda";
Pattern p = Pattern.compile("[{]([^{}]*)[}]");
Matcher m = p.matcher(s);
while (m.find()) {
System.out.println(m.group(1));
}
String text = "vlsdfjs;lfasal;fjdslfjsdalkfjsadlk{{内容1}}xxx{{内容1}}aaa{{内容1}}aa{{内容1}}aa{{内容1}}adsfasdfsda";
String regExp = "\\{\\{(.*?)\\}\\}";
Matcher m = Pattern.compile(regExp).matcher(text);
while (m.find())
System.out.println(m.group(1));