我大约有520行,看起来像这样:
**[[健忘症]]。父母:[[Slowpoke]] [[Slowbro]],[[Snorlax]]
**[[魅力]]。父母:[[Cottonee]]
**[[诅咒]]。父母:[[Slowpoke]],[[Slowbro]],[[Slowking]],[[Turtwig]],[[Grotle]],[[Torterra]],[[Ferroseed]],[[Ferrothorn]]
**[[忍受]]。父母:[[Shieldon]],[[Bastiodon]]
并且我想使用F&R以某种方式将“父母:”之后的每个[[word]]实例(例如,不是失忆症,魅力等等)更改为{{mpic | word}},并删除所有逗号,这样一行看起来像这样:
**[[健忘症]]。父母:{{mpic | Slowpoke}} {{mpic | Slowbro}} {{mpic | Snorlax}}
我已经搜索了很多,但是真的不知道是否只有一次或两个动作就可以实现(我不介意我是否必须做几件事-10倍大于520倍)。我只有Notepad ++版本5.9(并且无法更新),但我也有Word,因此,如果可以的话,请提供帮助!
Aww蛋动了!试试这个正则表达式:
(?:.*Parents?:|\G)[\s,]*\K\[\[([^\]]+)\]\],?
替换为:
{{mpic|$1}}
那应该做的:)
(?:
.*Parents?: # begins with ".*Parents?:"
| # or
\G # at the end of previous match
)
[\s,]* # match spaces and commas
\K # restart the match
\[\[ # match twin open square brackets
([^\]]+) # capture what's inside the square brackets
\]\] # match twin close square brackets
,? # match any comma that comes after it
我认为这\G
是在v6x版本中实现的。尝试以下解决方法:
\[\[([^\]]+)\]\](?![^:\n]*:),?
并替换为与以前相同的东西。尽管我认为效果也不错,但它稍微简单了一点。[[ ... ]]
只要:
在同一行的前面没有位置,它就会匹配。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句