You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

replace()

Usage

replace(template, entity)

Description
Replaces all template expressions in the given template string with values from the given entity. This method can be used to evaluate template expressions in database objects, for example to create customized e-mails etc.

Warning
Allowing user input to be evaluated in a template expression poses a security risk. You have no control over what the user can do!

Example

${replace('Welcome, ${this.name}!', me)}

results in

Welcome, admin!

Search results for "replace()"

replace()

Replaces all template expressions in the given template string with values from the given entity. This method can be used to evaluate template expressions in database objects, for example to create customized e-mails etc.

replace(template, entity)

str_replace()

Replaces each substring of the subject that matches the given regular expression with the given replacement.

str_replace(subject, search, replacement)