When installed, everytime you edit a non-talk page, the script will search for a standard set of regular expressions, allowing you to selectively replace them using a standard set of substitutions.
How the interface works is described in detail in the Gerbrant.edit.regexReplace documentation.
This script will only work in conjunction with Gerbrant.fw (documentation). If you're already using it, just add "Gerbrant.edit.autoReplace"
to the start of the list of modules to load, otherwise paste the following in your monobook.js
:
Gerbrant = {fw: {load: [ "Gerbrant.edit.autoReplace" ]}}
mw.loader.load("http://en.wikipedia.org/w/index.php?title=User:Gerbrant/fw.js&action=raw&ctype=text/javascript");
\
in the regular expression should be escaped: \d
becomes \\d
.![]() | This section needs expansion. You can help by adding to it. (May 2010) |
The following is a small example. I hope I didn't make any typos. The ellipses (...) indicate the possible presence of more settings (of other modules). Usually this will include the settings for Gerbrant.fw, as shown in the section titled "Installation".
Gerbrant = { ... edit: { ... autoReplace: { noDefault: true, lib: [ // This loads User:Gerbrant/edit/autoReplace/default.js. // Same effect can be achieved by not specifying the noDefault setting. "Gerbrant.edit.autoReplace.default", // Your own set of replacements. "ExampleUser.scriptname" ], defs: [ { // This example will replace things like A with A. re: "\\[\\[(.*?)\\|\\1\\]\\]", hf: function(a,b){return "" + b + "";} } ] } ... } ... }