【发布时间】:2016-04-24 22:23:50
【问题描述】:
我有一个string,其中包含一些文本,后跟一些具有不同内容的括号(可能为空)。我需要提取最后一个括号及其内容:
atext[d][][ef] // should return "[ef]"
other[aa][][a] // should return "[a]"
xxxxx[][xx][x][][xx] // should return "[xx]"
yyyyy[] // should return "[]"
我查看了RegexOptions.RightToLeft 并阅读了lazy vs greedy matching,但我这辈子都做不好。
【问题讨论】: