CanvasK

Joined December 15, 2019
m
(→‎To-do: Working on syncing battles. Series done. Fighters next. Events after. Stragglers last. Good night)
Line 56: Line 56:
=Handy Regex=
=Handy Regex=
Remove duplicate text in links when a suffix would work:<br/>
Remove duplicate text in links when a suffix would work:<br/>
Search: \[\['''{{color|red|<nowiki>([^\|]+)</nowiki>}}'''\|'''{{color|red|\1}}{{color|blue|([^\]]+)}}'''\]\]<br/>
Search: \[\[{{color|red|<nowiki>([^\|]+)</nowiki>}}\|{{color|red|\1}}{{color|blue|([^\]]+)}}\]\]<br/>
Replace: <nowiki>[[</nowiki>'''{{color|red|$1}}''']]'''{{color|blue|$2}}'''
Replace: <nowiki>[[</nowiki>{{color|red|$1}}]]{{color|blue|$2}}


Simple section/anchor link ([[Template:H2]]): <br/>
Simple section/anchor link ([[Template:H2]]): <br/>
Search: \[\['''{{color|red|([^\#]+)}}'''\#'''{{color|blue|([^\]]+)}}'''\|{{color|blue|\2}}\]\] <br/>
Search: \[\[{{color|red|([^\#]+)}}\#{{color|blue|([^\]]+)}}\|{{color|blue|\2}}\]\] <br/>
Replace: <nowiki>{{</nowiki>h2|'''{{color|red|$1}}'''|'''{{color|blue|$2}}'''<nowiki>}}</nowiki>
Replace: <nowiki>{{</nowiki>h2|{{color|red|$1}}|{{color|blue|$2}}<nowiki>}}</nowiki>


Bracket simplifier ([[Template:B]]): <br/>
Bracket simplifier ([[Template:B]]): <br/>
Search: \[\['''{{color|red|([^\)]+)}}''' \('''{{color|blue|([^\]]+)}}'''\)\|{{color|red|\1}}\]\] <br/>
Search: \[\[{{color|red|([^\)]+)}} \({{color|blue|([^\]]+)}}\)\|{{color|red|\1}}\]\] <br/>
Replace: <nowiki>{{</nowiki>b|'''{{color|red|$1}}'''|'''{{color|blue|$2}}'''<nowiki>}}</nowiki>
Replace: <nowiki>{{</nowiki>b|{{color|red|$1}}|{{color|blue|$2}}<nowiki>}}</nowiki>
 
3 param [[Template:S]] to [[Template:IW]]: <br/>
Search: <nowiki>{{</nowiki>s\|{{color|red|<nowiki>([^}]+)</nowiki>}}\|{{color|blue|<nowiki>([^}]+)</nowiki>}}\|{{color|green|<nowiki>([^}]+)</nowiki>}}<nowiki>}}</nowiki> <br/>
Replace: <nowiki>{{</nowiki>iw|{{color|red|$1}}|{{color|blue|$2}}|{{color|green|$3}}<nowiki>}}</nowiki>


Rollover/hover text ([[Template:Rollover]]): <br/>
Rollover/hover text ([[Template:Rollover]]): <br/>
Search: <nowiki><span</nowiki> class="explain" title="'''{{color|red|([^>]+)}}'''">'''{{color|blue|([^<]+)}}'''<nowiki></span></nowiki> <br/>
Search: <nowiki><span</nowiki> class="explain" title="{{color|red|([^>]+)}}">{{color|blue|([^<]+)}}<nowiki></span></nowiki> <br/>
Replace: <nowiki>{{</nowiki>rollover|'''{{color|blue|$2}}'''|'''{{color|red|$1}}'''|?<nowiki>}}</nowiki>
Replace: <nowiki>{{</nowiki>rollover|{{color|blue|$2}}|{{color|red|$1}}|?<nowiki>}}</nowiki>
 
<!--
Spirit type ([[Template:SpiritType]]): <br/>
Spirit type ([[Template:SpiritType]]): <br/>
Search: \[\[File:SpiritType'''{{color|red|([^\.]+)}}'''\.png.*\|\1\]\] <br/>
Search: \[\[File:SpiritType{{color|red|([^\.]+)}}\.png.*\|\1\]\] <br/>
Replace <nowiki>{{</nowiki>SpiritType|'''{{color|red|$1}}'''<nowiki>}}</nowiki>
Replace <nowiki>{{</nowiki>SpiritType|{{color|red|$1}}<nowiki>}}</nowiki>


Spirit type (variable size): <br/>
Spirit type (variable size): <br/>
Search: \[\[File:SpiritType'''{{color|red|([^\.]+)}}'''\.png\|'''{{color|blue|([^p]+)}}'''px.*\|\1\]\] <br/>
Search: \[\[File:SpiritType{{color|red|([^\.]+)}}\.png\|{{color|blue|([^p]+)}}px.*\|\1\]\] <br/>
Replace:<nowiki>{{</nowiki>SpiritType|'''{{color|red|$1}}'''|s='''{{color|blue|$2}}'''<nowiki>}}</nowiki>
Replace:<nowiki>{{</nowiki>SpiritType|{{color|red|$1}}|s={{color|blue|$2}}<nowiki>}}</nowiki>-->


"\…" is used to escape characters, preventing the regex from interpreting them as part of the regex command. "(…)" defines a capture group. "." matches any character. "*" matches 0-infinite of the prior character; ".*" matches 0-infinite of any character. "[…]" defines a set of characters. "^" is a NOT operator; "[^…]" equates to not these characters. "\1,2,3,..." references a capture group in the search field, counting up from left to right. "$1,2,3,..." references a capture group in the replace field, counting up from left to right.
"\…" is used to escape characters, preventing the regex from interpreting them as part of the regex command. "(…)" defines a capture group. "." matches any character. "*" matches 0-infinite of the prior character; ".*" matches 0-infinite of any character. "[…]" defines a set of characters. "^" is a NOT operator; "[^…]" equates to not these characters. "\1,2,3,..." references a capture group in the search field, counting up from left to right. "$1,2,3,..." references a capture group in the replace field, counting up from left to right.
32,034

edits