---
schema_version: "1"
id: d7e73310cc82e0ba4fa1608c52a20536f45d4432ede93f5ccd014a06c4d917e9
title: REPLACE
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/dato_data_mapping_formulas_replace.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.dato_data_mapping_formulas_replace.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 66bc51b85492e9b128cc19e2d3d75b748adc97dea08638d124b1f81028109326
description: Use the REPLACE function to replace characters or patterns in a string.
products:
  - Marketing
  - Marketing Cloud Intelligence
release: "264"
---
# REPLACE

Use the REPLACE function to replace characters or patterns in a string.

**Syntax:** `REPLACE(sourceStr,pattern,targetStr)`

For example, you can apply a replace function to media buy key values, replacing hyphens with spaces:

**Media buy key values:**

- Summer-sale-123
- New-deal-news
- ABC publish

**Formula:** `REPLACE(csv['media buy key'],'-',' ')`

**Output:**

- Summer sale 123
- New deal news
- ABC publish

All hyphens are removed and replaced with spaces. The third value with no hyphens remains the same.

The REPLACE function also supports the use of regular expressions. For example, the regular expression `\s` refers to all white-space characters. An additional backslash is added when using a regular expression with letters and numbers, such as `\s`, `\0`.

For example, you can apply the REPLACE function to replace spaces with hyphens.

**Formula:** `REPLACE(csv['media buy key'],'\\s','-')`

**Output**: 'media-buy-key'.

To use a special character, for example, an asterisk—considered a regular expression, as a regular character, add '`\\`' before the character.

For example:

**Formula:** `REPLACE(csv['me*a buy key'],'\\*','di')`

**Output**: 'media buy key'.

If the changes you want to apply to a string don’t require a regular expression, it’s recommended to use the SUBSTITUTE function.