Low Replace Documentation

Tags

Template tags#

Low Replace Tag

{exp:low_replace find="you" replace="we"}
    text you want processed
{/exp:low_replace}

Parameters

case=

When set to yes, the plugin performs a case sensitive find and replace.

find=

Text or pattern to replace. Required.

flags=

Additional pattern modifiers, use in combination with regex="yes". Use the case parameter instead of the i flag.

multiple=

When set to yes, you can use a | to define multiple values in both the find and replace parameters.

regex=

When set to yes, you can use a regular expression in the find parameter, and use callbacks in the replace parameter.

When set to raw, you can use a full regular expression pattern, including delimiters and flags. The case and flags parameters are ignored.

replace=

Replacement text. Defaults to an empty string.

Examples

Replace A with B:

{exp:low_replace find="you" replace="we"}
    text you want processed
{/exp:low_replace}

Result: text we want processed

Replace A with a space:

{exp:low_replace find="o" replace="SPACE"}
    text you want processed
{/exp:low_replace}

Result: text y u want pr cessed

Replace a space with nothing:

{exp:low_replace find="SPACE"}
    text you want processed
{/exp:low_replace}

Result: textyouwantprocessed

Replace a new line with a space:

{exp:low_replace find="NEWLINE" replace="SPACE"}
text
you
want
processed
{/exp:low_replace}

Result: text you want processed

Replace A, B and C with D:

{exp:low_replace find="a|e|i|o|u" replace="X" multiple="yes"}
    text you want processed
{/exp:low_replace}

Result: tXxt yXX wXnt prXcXssXd

Replace A, B and C with X, Y and Z:

{exp:low_replace find="text|you|want" replace="words|we|have" multiple="yes"}
    text you want processed
{/exp:low_replace}

Result: words we have processed

Regular Expression find and replace:

{exp:low_replace find="\w+" replace="*" regex="yes"}
    text you want processed
{/exp:low_replace}

Result:

Regular Expression find and replace with backreference:

{exp:low_replace find="<a href=QUOTE(.+?)QUOTE>(.*?)<\/a>" replace="$2 ($1)" regex="yes"}
    <a href="http://www.foo.com/">text</a> you want <a href="http://www.bar.com/">processed</a>
{/exp:low_replace}

Result: text (http://www.foo.com/) you want processed (http://www.bar.com/)

Support

Having problems setting up and/or using Low Replace? Support is offered from 10am to 4pm EST weekdays. Send us an email at help@eeharbor.com and we will respond as quickly as we can.