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

 * function
 * Constructs a multiReplace object.

Object members

 * add(p, h)
 * Adds pattern string, which will be replaced using handler function.


 * 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  and returns the new text.