This page describes a script. In general, it refers to the script in its current form, but pywikpedia coders tend only to add functions, not take them away. Chances are that you'll be able to use most of the information on the page, regardless of the age of your installation.
|Creator:||Daniel Herding & the Pywikipedia team|
|Code location:||wikimedia repository|
|What it does:||Text replacement|
Replace.py is a script that allows you to quickly replace strings of text with another string. This script can be used in conjunction with user-fixes.py to replace large amounts of text.
This will use the user-fixes file:
python replace.py -fix:(insert the name of the fix)
Command line examples
In its most basic form, replacy.py is formatted like so:
python replace.py "text to be replaced" "text to replace with"
Of course, this will do nothing without a range of pages set. You can use multiple parameters to achieve this.
For example, should you want to replace all links to
[[Example]], you might want to use a command line like this:
python replace.py "[[Exapmle" "[[Example" -ref:Exapmle
-ref here will restrict the search to pages that link to Exapmle.
If you want to include lower case links too, though, the easiest way to do this without the use of regex is to simply put two replacements in the same line. This is achieved by adding them in after the first two terms, also with quotation marks. Like so:
python replace.py "[[Exapmle" "[[Example" "[[exapmle" "[[example" -ref:Exapmle
Full list of available parameters
- -ns (or -namespace)