2
我試圖用正則表達式平衡組來匹配嵌套的標籤是這樣的:使用正則表達式平衡組來匹配嵌套的標籤
some text ...
{list}
nesting loop content
{list}
{list}
{list}
bala ...
{/list}
{/list}
{/list}
{/list}
end
我expresson:
\{(?<NAME>.+?)\}
[^\{\}]*
(
(
\{(?<NAME2>.+?)\}(?<OPEN>)
[^\{\}]*?
)
(
\{\/\<NAME2>\}(?<-OPEN>)
[^\{\}]*?
)
)*
(?(OPEN)(?!))
\{\/\<NAME>\}
我的問題:
only last 2 level pair can match.
使用HTML/XML解析器。 –