User talk:Gerbrant/edit/multiReplace.js

Gerbrant.edit.multiReplace
Provides a way to replace the occurrences of a set of regular expressions with the return values of a set of handler functions.
Note that the group detector is really brain-dead, so if you want to match against the left and right parentheses, you'll want to use \u0028 and \u0029.

Constructor

edit
function()
Constructs a multiReplace object.

Object members

edit
add(p, h)
Adds pattern string p, which will be replaced using handler function h.
handler(a)
This function handles one replacement. First argument should be the total match, the rest the submatches, if any.
getRE()
Gets the combined regular expression.
replace(t)
Performs the replacements on text t and returns the new text.