FANDOM


This page describes a bit of regex. It must be used within a script or user-fix.

Regex-button
Delete empty sections
Creator: CzechOut
What it does: Removes empty sections from pages
Complexity: Basic

Delete empty sections is a bit of replace.py regex that will help you get rid of empty sections on pages. All too frequently people put empty sections into pages, thinking that eventually they'll get filled in. So they might type something like:

== External links ==
''to be added''

But there are many, many pages that will never have external links. This regex scans for a section like this and then deletes it.

Code Edit

python replace.py -regex "\=\=( *?)External .*\n''.*''" ""

Explanation Edit

This regex will match a wide variety of permutations including:
==External links         ===
to be added

== External links==
''to be added''

==External link ==
''coming soon''

==External links==
''N/A''

Known limitations Edit

This script does expect for the "to be added" — or equivalent — line to be on the line directly underneath the section head. If there's an additional carriage return, this regex won't match.

This regex also expects a rational use of two equals signs around the section title. It could be easily fixed to check for any number of equal signs with this expression: (\=*?)

Also, because it was the practice that had emerged at w:c:tardis, this script also assumes that the line under the section head will be italicised. The regex could easily be changed to not expect that by simply removing the apostrophes.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.