---
title: "Replace ViewHelper <f:replace>"
manual: "Fluid Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/fluid:typo3fluid-fluid-replace"
source: "ViewHelpers/Fluid/Replace.rst"
rendered: "2026-10-08T14:12:40+00:00"
---

# Replace ViewHelper `<f:replace>` {#typo3fluid-fluid-replace}

> [!NOTE]
> This reference is part of the documentation of Fluid Standalone.
> If you are working with Fluid in TYPO3 CMS, please refer to
> [TYPO3's ViewHelper reference](https://docs.typo3.org/other/typo3/view-helper-reference/14.3/en-us/Global/Replace.html) instead.

The ReplaceViewHelper replaces one or multiple strings with other
strings. This ViewHelper mimicks PHP's `str_replace()` function.
However, it's also possible to provide replace pairs as associative array
via the "replace" argument.

## Examples {#examples}

### Replace a single string {#replace-a-single-string}

```php
<f:replace value="Hello World" search="World" replace="Fluid" />

```

```text
Hello Fluid
```

### Replace multiple strings {#replace-multiple-strings}

```php
<f:replace value="Hello World" search="{0: 'World', 1: 'Hello'}" replace="{0: 'Fluid', 1: 'Hi'}" />

```

```text
Hi Fluid
```

### Replace multiple strings using associative array {#replace-multiple-strings-using-associative-array}

```php
<f:replace value="Hello World" replace="{'World': 'Fluid', 'Hello': 'Hi'}" />

```

```text
Hi Fluid
```

Go to the source code of this ViewHelper: [ReplaceViewHelper.php (GitHub)](https://github.com/TYPO3/Fluid/blob/main/src/ViewHelpers/ReplaceViewHelper.php).

**Arguments**

The following arguments are available for the replace ViewHelper:

-   **replace**

    -   *Type:* mixed
    -   *Required:* true

-   **search**

    -   *Type:* mixed

-   **value**

    -   *Type:* string
