---
schema_version: "1"
id: 794f756d1dd61cf4eb32982aa08b4e13d8d29ff77cb6557e184eac79db0a3c00
title: replaceAll
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/latest/dw-strings-functions-replaceall.md
canonical_url: https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-replaceall
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a391af59fc6e11d9cd32f7f727d7afd453d5c7586402b8f5972f2eeb2083f654
description: MuleSoft Documentation Site
release: "2.13"
latest: true
---
---
product: DataWeave
version: 2.13
is-latest-version: true
---

# replaceAll

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## replaceAll(text: String, target: String, replacement: String): String

Replaces all substrings that match a literal search string with a specified replacement string.

Replacement proceeds from the beginning of the string to the end. For example, the result of
replacing `"aa"` with `"b"` in the string\` `"aaa"` is `"ba"`, rather than `"ab"`.

_Introduced in DataWeave version 2.4.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>text</code></p></td><td><p>The string to search.</p></td></tr><tr><td><p><code>target</code></p></td><td><p>The string to find and replace in <code>text</code>.</p></td></tr><tr><td><p><code>replacement</code></p></td><td><p>The replacement string.</p></td></tr></tbody></table>

### Example

This example shows how `replaceAll` behaves with different inputs.

#### Source

```DataWeave
import * from dw::core::Strings
output application/json
---
{
    a: replaceAll("Mariano", "a" , "A"),
    b: replaceAll("AAAA", "AAA" , "B"),
    c: replaceAll(null, "aria" , "A"),
    d: replaceAll("Mariano", "j" , "Test"),
}
```

#### Output

```Json
{
   "a": "MAriAno",
   "b": "BA",
   "c": null,
   "d": "Mariano"
 }
```

## replaceAll(text: Null, oldValue: String, newValue: String): Null

Helper function that enables `replaceAll` to work with a `null` value.

_Introduced in DataWeave version 2.4.0._
