Fullscreen
[Show/Hide Right Column]

Perform a regular expression search and replace

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).

Usage and Parameters

To use this plugin in a wiki page, use the syntax:
{REGEX(pageName= )}The search and replace is performed on this text{REGEX}


Required parameters are in bold
Preferences required: wikiplugin_regex
Parameters Accepted Values Description Default Since
pageName Name of page containing search and replace expressions separated by two colons. Example of syntax on that page: /search pattern/::replacement text pageName



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,
{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

Contributors to this page: Marc Laporte9140 points  , lindon132 điểm  and luciash d' being2160 points  .
Page last modified on Monday 16 April, 2012 04:59:49 UTC by Marc Laporte9140 points .
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.

Site Language

Reference Guide

Keywords

These keywords serve as "hubs" for navigation within the Tiki documentation. They correspond to development keywords (bug reports and feature requests):



Tiki Newsletter

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other news!
Contribute to Tiki