str_replace()

Usage

str_replace(subject, search, replacement)

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

Example

${str_replace("Hello Wrlod!", "Wrlod", "World")}
${str_replace("a 1 b 2 c 3 d 4", "\\s", "")}
${str_replace("a 1 b 2 c 3 d 4", "\\d", "")}
${str_replace("a 1 b 2 c 3 d 4", "\\d\\s", "")}
${str_replace("a 1 b 2 c 3 d 4", "[\\d\\s]", "")}

results in

Hello World!
a1b2c3d4
a b c d 
a b c d 4
abcd
About this article
Last change 2020-01-23
Topics Structr 2.0