The replace
filter formats a given string by replacing the placeholders (placeholders are free-form):
{{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }} {# outputs I like foo and bar if the foo parameter equals to the foo string. #}
from
: The placeholder values
© 2009–2017 by the Twig Team
Licensed under the three clause BSD license.
The Twig logo is © 2010–2017 SensioLabs
http://twig.sensiolabs.org/doc/2.x/filters/replace.html