给定一个 wikiText 字符串,例如:
{{ValueDescription
|key=highway
|value=secondary
|image=Image:Meyenburg-L134.jpg
|description=A highway linking large towns.
|onNode=no
|onWay=yes
|onArea=no
|combination=
* {{Tag|name}}
* {{Tag|ref}}
|implies=
* {{Tag|motorcar||yes}}
}}
我想在 Java/GroovyValueDescription
中解析模板。Tag
我尝试使用正则表达式/\{\{\s*Tag(.+)\}\}/
,它很好(它返回|name
|ref
and |motorcar||yes
),但
/\{\{\s*ValueDescription(.+)\}\}/
不起作用(它应该返回上面的所有文本)。
预期输出
有没有办法跳过正则表达式中的嵌套模板?
理想情况下,我宁愿使用简单的wikiText 2 xml工具,但我找不到类似的东西。
谢谢!穆龙