Pybot Wiki

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
Complexity: Basic is a script that allows you to quickly replace strings of text with another string. This script can be used in conjunction with to replace large amounts of text.

This will use the user-fixes file:

python -fix:(insert the name of the fix)

Command line examples[]

In its most basic form, is formatted like so:

python "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 [[Exapmle]] with [[Example]], you might want to use a command line like this:

python "[[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 "[[Exapmle" "[[Example" "[[exapmle" "[[example" -ref:Exapmle

Full list of available parameters[]

  • -cat
  • -catr
  • -file
  • -subcats
  • -subcatsr
  • -transcludes
  • -page
  • -ref
  • -filelinks
  • -links
  • -start
  • -prefixindex
  • -titleregex
  • -search
  • -save
  • -savenew
  • -excepttitle
  • -excepttext
  • -exceptinside
  • -exceptinsidetag
  • -summary
  • -fix
  • -replacementfile
  • -ns (or -namespace)
  • -always
  • -recursive
  • -nocase
  • -allowoverlap
  • -regex
  • -dotall
  • -multiline