User:Tol/Regex
Appearance
< User:Tol
This is a list of regexes for my convenience.
2017 Wikitext Editor
[edit]- All reference tags
<ref(?:.*?)<\/ref>
- Curly quotes
[“”‘’]
Needs work
[edit]- References without a {{Cite *}} template
<ref>(?!{{(C|c)ite)
- All {{Cite *}} templates
{{(C|c)ite(.*?)}}
- Internal external links
\[https:\/\/en\.wikipedia\.org\/wiki\/(.*?) (.*?)\]
- Fix reference punctuation
(\<ref(?:.*?)(?:\/\>|</ref>))([,.])?
$2$1
- Add scope (for List of presidents of the United States)
! (?:(rowspan=[234] )\| )?\[\[Presidenc
! scope="row" $1| [[Presidenc
AWB1
[edit]
Setup:
Summary:
Find and replace:
|
AWB2
[edit]Setup:
Summary:
[[User:Tol/Regex#AWB2|AWB2]]: use [[WP:IBI|plain image in infobox]] instead of thumbnail
Find and replace:
- Regex
- From:
\n( *?)\|( *?)(image(?:_?\d)?|image_name|map_image|logo)( *?)\=[ \n]*?\[\[(?:File|Image)\:(.*?)\|thumb(?:\|(?:\d*?px)?)?\]\]
(automatic, no intervention required)\n( *?)\|( *?)(image(?:_?\d)?|image_name|map_image|logo)( *?)\=[ \n]*?\[\[(?:File|Image)\:(.*?)\|thumb(?:.*?)\]\]
(manual, does most of the work but captions must still be manually checked)
- To:
\n$1|$2$3$4= $5
AWB3
[edit]Setup:
Summary:
[[User:Tol/Regex#AWB3|AWB3]]: add [[Template:Taxonbar]]
Find and replace:
- Regex
- From:
(?:\n*?)(?=(\{\{(?:A|a)uthority control|\{\{DEFAULTSORT|\[\[Category))
- To:
\n\n{{subst:#if:{{subst:#invoke:wd|label|raw}}|{{Taxonbar|from={{subst:#invoke:wd|label|raw}}}}|{{Taxonbar}}}}\n\n
Skip:
- Redirects
- When no changes were made
- When page does not exist
- When page is member of category:
AWB4
[edit]Setup:
Summary:
[[User:Tol/Regex#AWB4|AWB4]]: add "from" parameter to [[Template:Taxonbar]]
Find and replace:
- Regex
- From:
\{\{[Tt]axonbar(?:\|from\=\s*?)?\}\}
- To:
{{subst:#if:{{subst:#invoke:wd|label|raw}}|{{Taxonbar|from={{subst:#invoke:wd|label|raw}}}}|{{Taxonbar}}}}
AWB5
[edit]Setup:
- Category:
Summary:
[[User:Tol/Regex#AWB5|AWB5]]: Use [[Template:Draft categories]]
Find and replace:
- Regex
- From:
\n?((?:\s*?\[\[:?[Cc]ategory:(?:.*)\]\]\s*?)+)\n?
- To:
\n\n{{Draft categories|1=\n$1\n}}\n
- Ignore unparsed content
- From:
- Plain text
- From:
[[:Category
- To:
[[Category
- From:
Skip:
- When page contains:
\{\{[Dd]raft cat
- Regex
- Redirects
- When no changes were made
- When page does not exist