java正则表达式:查找所有{XXX}

 1         String pattern = "\{[^\}]+\}";  // [^\}]表示除}以外的其他字符
 2         //  创建 Pattern 对象
 3         Pattern r = Pattern.compile(pattern);
 4 
 5         String str = "您好,{a||b||c},这里是{d||e||f}";
 6         // 现在创建 matcher 对象
 7         Matcher m = r.matcher(str);
 8         while (m.find()) {
 9             System.out.println(m.group());
10         }

打印为:

{a||b||c}
{d||e||f}
原文地址:https://www.cnblogs.com/skyeyh/p/3708858.html