我有一個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讀了,但我不能爲我的生命得到這樣一個權利。
【檢查】(https://regex101.com/r/bZ9tP4/1) – rock321987