aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/twig/twig/doc/filters/replace.rst
blob: e961f23d49b6ef9f9a4a7e23d003e53a828128e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
``replace``
===========

The ``replace`` filter formats a given string by replacing the placeholders
(placeholders are free-form):

.. code-block:: jinja

    {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }}

    {# returns I like foo and bar
       if the foo parameter equals to the foo string. #}

Arguments
---------

 * ``replace_pairs``: The placeholder values

.. seealso:: :doc:`format<format>`