我想使用正则表达式通过否定组来提取内容(而不是进行搜索和替换)
要获取信息框块,我使用以下正则表达式。
(\{\{Infobox(?:.*?)^\}\})
如何否定该组,以便返回没有信息框的文本。我尝试了很多组合,比如
(.*(?!(?:\{\{Infobox(?:.*?)^\}\})).*)
这是我试图提取的示例文本。
<username>Majorclanger</username>
<id>817248</id>
</contributor>
<minor />
<comment>rm unneeded hyphen</comment>
<text xml:space="preserve">{{sprotected2}}
{{Infobox MLB player
| birthplace = {{city-state|Riverside|California}}
| debutdate = May 30
| debutyear = 1986
}}
==Early life==
{{Infobox Person
|parents =
|relatives =
|signature =
|website =
}}
Born in {{city-state|Riverside|California}}, Bonds grew up in {{city-state|San Carlos|California}} and attended