Skip to main content
REPLACE

Replaces all occurrences of a specified search string with a replacement string

Updated over a week ago

Description

The REPLACE() function is used to replace all occurrences of a specified search string with a replacement string within a given text. It's a versatile tool for text manipulation and data cleaning.

Syntax

REPLACE(text, search, replace)

Output

text

Variables

  1. text: The input text string in which you want to perform replacements.

  2. search: The text you want to find and replace.

  3. replace: The text with which you want to replace the found search string.

The REPLACE() function is case-sensitive, meaning it will only replace text that exactly matches the specified search string in terms of both character sequence and letter case. If you need case-insensitive replacement, you may consider using REGEX_REPLACE() to achieve the desired result.

Example

REPLACE(`Text`,"SALE","DISCOUNT")

ID

Text

REPLACE

1

Huge SALE on electronics today!

Huge DISCOUNT on electronics today!

2

Special SALE: Save 20% on select items.

Special DISCOUNT: Save 20% on select items.

3

No SALE available for this product. SALE

No DISCOUNT available for this product. DISCOUNT

Did this answer your question?