用于MediaWiki Wikitext模板的正则表达式 [英] Regex for MediaWiki wikitext templates
问题描述
Yaron Koren的ReplaceText MediaWiki扩展使我可以使用正则表达式替换MediaWiki中的文本.我大约有300个MediaWiki页面,其中有两个模板实例.我只想使用正则表达式删除第二个模板. (什么都不要替换)
Yaron Koren's ReplaceText MediaWiki extenion allows me to use regular expressions to replace text in MediaWiki. I have about 300 MediaWiki pages that have two instances of a template. I want to delete only the second template using regular expressions. (replace it with nothing)
我有:
}} <--end of first template-->
{{Template Call
|blahField=blahValue
|blahField=blahValue
|...
}}
我想我要搜索:^[ \\}} \r \\{{ *? ]
并替换为:^[ \\}} ]
,但是当我在 rexv.org
感谢一些有关正则表达式的帮助.
Appreciate some help with regular expressions.
推荐答案
在扩展页面上它说
所允许的正则表达式集基本上只是PHP和MySQL正则表达式集的一小部分(它仅通过MySQL进行过测试-能否在其他数据库系统上运行尚不清楚).搜索字符串中可以使用的字符是().* +?[] |"
The set of regular expressions allowed is basically a small subset of the PHP and MySQL regular-expression sets (it has only been tested with MySQL - whether it works on other database systems is unknown). The characters that one can use in the search string are "( ) . * + ? [ ] |"
所以也许您正在使用的字符不起作用. \可能把它弄乱了吗?
So maybe the characters you are using don't work. Is it possible the \ is messing it up?
这篇关于用于MediaWiki Wikitext模板的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!