have you read this? there is a sample like what you need...
http://www.unibetter.com/deerchao/zhengzhe-biaodashi-jiaocheng-se.htm#balancedgroup
---------------
平衡组的一个最常见的应用就是匹配HTML,下面这个例子可以匹配嵌套的<div>标签:<div[^>]*>[^<>]*(((?'Open'<div[^>]*>)[^<>]*)+((?'-Open'</div>)[^<>]*)+)*(?(Open)(?!))</div>.
---------------