public static void main(String[] args) {
        String source = "first {test} is here,two {test2} is here!";
        String find = "\\u007B.*\\u007D";
        Pattern pattern = Pattern.compile(find);
        Matcher matcher = pattern.matcher(source);
        while(matcher.find()) {
            System.out.println(matcher.group());
        }
}
我要实现的是将{test}和{test2}提取出来。但是用String find = "\\u007B.*\\u007D";获取出来的是
{test} is here,two {test2}
貌似获取的是第一个{和最后一个}。我怎么能用正则去提取每一对{}的呢?
因为这个字符串的内容不是固定的。所以无法使用类似下面的方式解决:    String input = "first {test} is here,two {test2} is here!";
    Scanner scanner = new Scanner (input);
    scanner.findInLine ("first (.+) is here,two (.+) is here!");
    MatchResult result = scanner.match();