regex_replace

Parameter PositionTypeRequiredDefaultDescription
1stringYesn/aThis is the regular expression to be replaced.
2stringYesn/aThis is the string of text to replace with.

A regular expression search and replace on a variable. Use the syntax for preg_replace() from the PHP manual.

Example 5-13. regex_replace

{* replace each carriage return, tab & new line with a space *}

{$articleTitle}
{$articleTitle|regex_replace:"/[\r\t\n]/":" "}

OUTPUT:

Infertility unlikely to
 be passed on, experts say
Infertility unlikely to be passed on, experts say