---
schema_version: "1"
id: 56bde5419a73d736d24618d0c7241efde027cd71f0840fdfccd4b4fcbcba0ac9
title: with
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.3/dw-core-functions-with.md
canonical_url: https://docs.mulesoft.com/dataweave/2.3/dw-core-functions-with
source_site: docs.mulesoft.com
content_type: documentation
content_hash: d5a0523493141c7ec976b0e2b384ea0be34f1695e9f282c77b846cd48b7026d3
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: DataWeave
version: 2.3
---

# with

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

## with(((V, U) -> R) -> X, (V, U) -> R): X

Helper function that specifies a replacement element. This function is used with `replace`, `update`
or `mask` to perform data substitutions.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>toBeReplaced</code></p></td><td><p>The value to be replaced.</p></td></tr><tr><td><p><code>replacer</code></p></td><td><p>The replacement value for the input value.</p></td></tr></tbody></table>

### Example

This example replaces all numbers in a string with "x" characters. The `replace` function specifies
the base string and a regex to select the characters to replace, and `with` provides the replacement
string to use.

#### Source

```DataWeave
%dw 2.0
output application/json
---
{ "ssn" : "987-65-4321" replace /[0-9]/ with("x") }
```

#### Output

```JSON
{ "ssn": "xxx-xx-xxxx" }
```
