Extension:RegexFunctions

Usage
As of now, this extension defines three parser functions, rmatch, rsplit, and rreplace
 * rmatch:
 * string (required): The text the function uses for the matching.
 * pattern (required): The regular expression to use on the text. May contain up to nine capturing groups.
 * return (required): What to return if the match was successful. $1 - $9 contain the captured text, and \\1 - \\9 contain the offsets of the captured text.
 * notfound (optional): What to return if the match was not successful. Defaults to an empty string.
 * offset (optional): The offset in bytes to start the match at. Defaults to 0 (the beginning of the text).


 * rsplit:
 * string (required): The text the function will split.
 * pattern (required): The regular expression to use on the text. No text is captured.
 * piece (optional): The piece to return. Defaults to 0 (the first piece).


 * rreplace:
 * string (required): The text the function will replace.
 * pattern (required): The regular expression to use on the text. May contain any number of capturing groups.
 * replace (required): The text to replace the matched text with. Both $# and \# will call the capturing groups, use \${#}# if you want a group followed by another number.

Installation
Please download the files from Subversion and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php. Then, add the following to the bottom of LocalSettings.php:

Configuration parameters

 * $wgRegexFunctionsPerPage:How many functions are allowed per page. Default is 10, but it is recommended that it is set above 3 for usability
 * $wgRegexFunctionsAllowModifiers:Allows modifiers (e.g. /g and /i for global matching and case insensitivity). Does not enable the /e modifier in the rreplace function, see the next variable for that. Defaults to true.
 * $wgRegexFunctionsAllowE:Allows the /e modifier in rreplace, which treats the 'replace' text as PHP code. Don't enable this unless you trust all of your users, as it opens up XSS vectors and other security concerns. Defaults to false.
 * $wgRegexFunctionsLimit:Limit for the number of pieces in the rsplit function and replaces in the rreplace function. -1 is unlimited. Defaults to -1.
 * $wgRegexFunctionsDisable:Array of functions you want to disable. Defaults to an empty array.

Changelog

 * Version 1.0:Initial Release, defines three functions: rmatch, rsplit, and rreplace