Plugin Regex

Use this wiki plugin to use a "regular expression" style search expression from another wiki page to search for and replace text in the body of the plugin (between the REGEX tags).

Parameters

Perform a regular expression search and replace
Introduced in Tiki 1. Required parameters are in bold.
Go to the source code
Preferences required: wikiplugin_regex

Parameters Accepted Values Description Default Since
(body of plugin) Each line of content is evaluated separately
pageName Name of page containing search and replace expressions separated by two colons. Example of syntax on that page: /search pattern/::replacement text pageName 1


To use this plugin:

  1. Place the search pattern (enclosed with forward slashes) and replacement text on a separate wiki page, separated by two colons ( :: ). For example:
    /search pattern/::replacement text
  2. Then enter that page name as the pageName parameter value of the plugin.
  3. The text in the body of the plugin (between the REGEX tags) will be searched and each match of the search pattern will be replaced by the replacement text.


This plugin mimics the preg_replace PHP function. For advanced search patterns, see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php in the online PHP manual or simply search the internet for "regular expression syntax".

Example

This code:

Copy to clipboard
{REGEX(pageName="PluginRegex Example")}I had a horrible day.{REGEX}


Plus this syntax on a separate wiki page called PluginRegex Example:

/horrible/::wonderful

Would produce:

I had a wonderful day.

Aliases

Plugin Regex | PluginRegularExpression | Plugin RegularExpression | Plugin Regular Expression