求大牛帮忙
MIN/D{devId}_{year}_{month}/{day}_{hour}/{minute}_{interval}_{linkId}L.{type}
用正则表达式取出{}中的所有内容。
好心的大牛来帮帮我吧。

解决方案 »

  1.   


      public static void main(String[] _s) {
        String str = "MIN/D{devId}_{year}_{month}/{day}_{hour}/{minute}_{interval}_{linkId}L.{type}";
        Pattern p = Pattern.compile("\\{([^\\}]*)\\}");
        Matcher m = p.matcher(str);
        while (m.find()) {
          System.out.println(m.group(1));//group(1),也行,对你的需求来说
          //按需做处理
        }
      }