Contact Us 1-800-596-4880

with

with<V, U, R, X>(toBeReplaced: ((V, U) -> R) -> X, replacer: (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

Name Description

toBeReplaced

The value to be replaced.

replacer

The replacement value for the input value.

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

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

Output

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