Difference between revisions of "Reference:Replace Text"

m (Text replacement - "|edition=BlueSpice free |active=Yes" to "|edition=BlueSpice free, BlueSpice pro, BlueSpice Farm, BlueSpice Cloud |active=Yes")
 

Extension: Replace Text


Overview
Description: Provides a form to let administrators do string replacements on the entire wiki, for both page contents and page titles.
State: stable Dependency: MediaWiki
Developer: Yaron Koren, Niklas Laxström License: - GPL v2+
Type: MediaWiki Category: Administration
Edition: BlueSpice free, BlueSpice pro, BlueSpice Farm, BlueSpice Cloud
For more info, visit Mediawiki.

Features[edit source]

The ReplaceText extension from MediaWiki provides features allows to change text passages in articles pages or article page titles . With a form, the throughout the entire wiki. The existing text and the wanted replacement text can be typed entered in a form. The extension searches for this these words or text passages and replaces it automatically. For this purpose, also filters them after a confirmation screen. Filters and configurations are available. In addition to this, also complex text changes can be done achieved by using placeholders and regular expressions.  

Icon-note.png
Hint

The MediaWiki extension ReplaceText can be used with both MediaWiki and BlueSpice. The extension is available for download in our  BlueSpice Marketplace.

Where do I find ReplaceText?[edit | edit source]

To make this global changes, the extension provides a form at a special page. You can find it in the list of all special pages (Special:SpecialPages) in paragraph "Data and tools" or directly at Special:ReplaceText.

The "ReplaceText Form"[edit | edit source]

Strictly speaking, there are two forms. In the first form you can:

  • type in the already exiting, to be changed text
  • type in the wanted, new text
  • activate the checkbox for the usage of placeholders or regular expressions
  • choose the namespaches, in which the changes should take place
  • select additional filters for categories or page prefixes
  • activate replacement for text or titles

If you made all your entries and configurations in this form, you will be led to the second form by clicking on the "Continue" button. All found articles and article titles, which contain the substitutional parts, will be listed there. Uncheck the boxes of the articles, which should not be changed. Moreover, there are two further options for configuration. Changes on the article title will be realized by Changes on the page title result in moving the original page - according to the wiki principle. Due to this, there There are some configurations for the moved page. Decide if: 

  • there should be a redirect from the moved page to the new one
  • this page should be added to your watchlist

Confirm your choice with the "Replace" button to trigger the automatic replacement of the text passages. The last step is a confirmation from the system, which shows you what has been replaced and in how many articles this has been done. 

Usage of regular expressions[edit | edit source]

To use regular expressions for replacing text, the corresponding box in the first form must be checked to activate the functionality. Only a subset of the regular expressions of PHP and MySQL can be used. The following characters can be used:

                ( ) . * + ? [ ] |  as well as $1, $2 etc.
            

If the characters should be interpreted as real characters and not as part of a regular expression, a "\" must be added beforehand (like in the second example below: the dot is interpretet as a dot).

Examples:

Search String Replace String Behaviour
a(.*)c ac$1 Places all characters between a nad c at the end, e.g.:
azioc to aczio
([0-9]*)\.([0-9]*) $1,$2 Replaces the dot between the two numerical orders with a comma, e.g.:
2465.8924 zu 2465,8924

 [edit | edit source]

If you want to move a text part, which is placed between two numerical orders, you would type in the following regular expression according to the example given above:
Search String: 123(.*)456

Replace String: $1123456

to move the text from the middle to the beginning.

Due to the fact that a numerical order follows, the placeholder ($1) can not be used like meantioned above. In this case, the placeholder must be put in brackets to explicitly assign the numbering:
Replace String: {$1}123456

Automatic replacements and version history[edit | edit source]

Also automatically done changes are edits or the article content and will be stored as new versions of the article. Those versions are marked as minor edits and have an entry in the version history of the article. Also further meta information is saved there in addition to the normal data like the time stamp, the editor, etc. Further information for replacements with ReplaceText: 

  • ruther designation of the user who initiated the replacement
  • information about the process (e.g. "moved the page xy to yx without a redirect")
  • the kind of text replacement

Useful links[edit | edit source]

For more information visit MediaWiki.


Attachments

Discussions