From MediaWiki.org
Jump to: navigation, search

This extension allows administrators to perform a single edit across multiple pages in one step, by running a regular expression over the content of each page. This is well suited to performing simple edits such as renaming a template, adding pages to a category, or correcting typos (all of which can be done in the same edit operation by supplying multiple regular expressions.)

MediaWiki extensions manual
Crystal Clear action run.png

Release status: beta

Implementation Page action, Special page
Description Use regular expressions to edit multiple pages at once
Author(s) Adam Nielsen (Malvineoustalk)
Latest version r6 (2013-07-14)
MediaWiki 1.14-1.15 (<=r4), 1.18 (r5), 1.21+ (r6)
License GPL
Added rights


Hooks used


Translate the MassEditRegex extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Usage[edit | edit source]

Once the extension has been installed and permission masseditregex to use MassEditRegex has been given, go to Special:MassEditRegex and fill out the edit form (see screenshot).

Features[edit | edit source]

  • Transform each page using one or more regular expressions in a single step
  • Edits appear as "bot" so they don't show up in the normal edit list (unless the user chooses to show bot edits)
  • Only users with the masseditregex permission can perform changes
  • A new 'edit all' tab appears on category pages and on Special:WhatLinksHere, for editing all listed pages at once
  • Pages to edit can be specified as:
    • A list of page names
    • A list of page name prefixes (e.g. "Test" will match pages called "Testing" and "Tested")
    • A list of categories (all pages within the categories will be edited)
    • A list of backlinks (pages edited are those linking to the ones in the list)

Installation[edit | edit source]

Requirements[edit | edit source]

Download[edit | edit source]

You can download the extension directly from the MediaWiki source code repository (browse code). You can get:

One of the extension's tags

Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag

  • Go to the tags list
  • Click the name of the tag you want to download
  • Click "snapshot"
The latest version of one of the extension's branches

Each extension has a master branch containing the latest code (might be unstable). Extensions may have further branches as well.

  • Go to the branches list
  • Click the branch name
  • Click "snapshot"
A snapshot made during the release of a MediaWiki version.

This might be unstable and is not guaranteed to work with the associated MediaWiki version.

After you've got the code, save it into the extensions/MassEditRegex directory of your wiki.

If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/MassEditRegex.git

Setup[edit | edit source]

Add the following to LocalSettings.php:

require_once ( "$IP/extensions/MassEditRegex/MassEditRegex.php" );
$wgGroupPermissions['sysop']['masseditregex'] = true; // Allow administrators to use Special:MassEditRegex
$wgGroupPermissions['massedit']['masseditregex'] = true; // Create 'massedit' group where members can use Special:MassEditRegex without being sysops

Bugs / Known Issues[edit | edit source]

  • Depending on your webserver's PHP config, scripts may time out after 30 seconds or less. In this case you will need to check your contributions page to see which articles have been edited and remove those from the list before performing the edit again.

Troubleshooting[edit | edit source]

  • If you get an error or a blank page when applying your edits, an error has probably occurred, most likely from trying to edit too many pages in one go. Until this is fixed, try splitting the edit into two or more smaller groups of pages.