sdsdssd, it may have some extra code here with {}我需要提取\add[sometext]{和}之间的字符串(i.e.till \add标记结束大括号),\add[sometext]{和}之间的字符串可能会有所不同,所以我不能在regex模式中指定这些字符串,我应该只考虑开
String sourceString="This {is} a sample {string} that {contains} {substrings} inside curly {braces}";下面是我为获得结果而编写的代码,但我得到的输出是:
"{is} a sample {string} that{contains} {substrings} inside cur
我不是Regex方面的专家。我正在尝试创建一个正则表达式,它将完全匹配相同数量的左花括号和右花括号,但我对如何做到这一点感到困惑。c {{{ a another {{ nothing }} }}} }one { two {{ error, forgot ending brace }}
问题是我不知道我会事先得到多少个花括号在第一个示例中,我需要获取文本{ c {{{ a another {{ nothing