怎么用正则表达式 提取字符串中被大括号包着的字符

例如: string str = "d{1}hdd{abc}{2}";

提取 其中的 1,abc,2 分组添加到集合

JAVA 或 C#实现方式都可以

pattern:

 \{([^\}]+)\}

匹配模式: global 模式

                    C#搞定


                    string str = "d{1}hdd{abc}{2}";
                    pattern = "{(.*?)}";
        mc = Regex.Matches(str, pattern);
        foreach (Match item in mc)
        {
            list.Add(item.Groups[1].Value);
        }