The RegexParserFunctions Extension is a MediaWiki extension that adds a parser function for performing regular expression replacements on text.
It is released under The MIT License.
This extension requires:
require_once('extensions/RegexParserFunctions.php');
Once installed, editors of your wiki can evaluate regular expressions in one of two ways: simple match, and replacement.
In match mode, #regex expects two arguments: a subject and a pattern. The output of the function is either the exact text of the match, or nothing if no match could be made.
For example, this:{{#regex:abcdefg|/c.*f/}}
Would return this: cdef
In replacement mode, #regex expects three arguments: a subject, a pattern to match and a replacement expression. The output of the function is the result of replacing all matching strings with the replacement expression.
For example, this:{{#regex:abcdefg|/c.*f/|X}}
Would return this: abXg
Or, say you're trying to grab the last portion of a Title which is using a '/' to delimit subpages. For that, you could use:
{{#regex:{{PAGENAME}}|%^.*/(.*)$%|$1}}
Got something to say?
or, read what others have said ...