我使用以下正則表達式用於從所述表達找到組C#正則表達式 - 沒有得到外組
string pattern = @"(?<member>(?>\w+))\((?:(?<parameter>(?:(?>[^,()""']+)|""(?>[^\\""]+|\\"")*""|@""(?>[^""]+|"""")*""|'(?:[^']|\\')*'|\((?:(?<nest>\()|(?<-nest>\))|(?>[^()]+))*(?(nest)(?!))\))+)\s*(?(?=,),\s*|(?=\))))+\)";
像
string Exp = "GetValue(GetValue(GetValue(1 + 2) * GetValue(3 * 4))/GetValue(GetValue(5 * 6)/7)/8)";
我正在下列基團:
a)GetValue(GetValue(1 + 2)* GetValue(3 * 4))
b)GetValue(GetValue(5 * 6)/ 7)
我得到所有的組,但外組(GetValue(..../8))沒有得到?
模式中可能出現什麼問題?
我試着創建一個正則表達式,但它什麼也沒有匹配:http://regexr.com?2voqv – 2012-01-18 14:01:04
你能解釋一下預期的結果嗎?具體來說,你期望在每個組中捕獲什麼:member,parameter,nest,-nest。 – Grinn 2012-01-18 15:20:09