REPLACE

functionsupportedCore SQL functions

docs.snowflake.com ↗

String & binary functions

Removes all occurrences of a specified substring, and optionally replaces them with another substring.

Syntax

REPLACE( <subject> , <pattern> [ , <replacement> ] )

Parameters

NameRequiredDescription
subjectrequiredThe subject is the string in which to do the replacements. Typically, this is a column, but it can be a literal.
patternrequiredThis is the substring that you want to replace. Typically, this is a literal, but it can be a column or expression. Note that this is not a “regular expression”; if you want to use regular expressions to search for a pattern, use the REGEXP_REPLACE function.
replacementrequiredThis is the value used as a replacement for the pattern. If this is omitted, or is an empty string, then the REPLACE function simply deletes all occurrences of the pattern.

Returns

The returned value is the string after all replacements have been done.

Usage notes

Collation details

The collation specifications of all input arguments must be compatible. This function does not support the following collation specifications: - pi (punctuation-insensitive). - cs-ai (case-sensitive, accent-insensitive).