Plugin Information
Find and Replace 1.3
- Author:
- Lodewijk
- Published:
- Dec 13, 2005
- Last Updated:
- Mar 05, 2007
- License:
- Freeware
- Categories:
- Plugins Output Text Text Formatting
This plugin works pretty much the same as the php str_replace() or preg_replace() function.
Example Usage
{exp:replace find=“you” replace=“we”}
text you want processed
{/exp:replace}
{exp:replace find=“w+” replace=”*” regex=“yes”}
text you want processed
{/exp:replace}
Notes
This plugin works pretty much the same as the php str_replace() function:http://www.php.net/manual/en/function.str-replace.php and the preg_replace() function:
http://www.php.net/manual/en/function.preg-replace.php
ExpressionEngine strips the white space from the beginning and the end of each parameter. Because of this,
if you want to replace something with a space, use the string "SPACE" instead.
If you want to use a double quote in a parameter value, use the string "QUOTE" instead.
Note: if you want to replace something with nothing, best is to omit the replace parameter altogether. If you want to find multiple strings, always use the multiple="yes" parameter, or else it will search for the literal string, including vertical bars. The multiple parameter has no effect when using a regular expression find and replace.
This function is case sensitive by default. Use the parameter casesensitive="no" to ignore case, both for a normal as for a regular expression find and replace.
When using regex="yes" it is recommended that you set your Debug Preference (Admin > System Preferences > Output and Debugging Preferences) to 1, so Super Admins can make sure their regular expressions aren't generating server errors.

