REGEX_REPLACE

Replaces text that matches a regular expression pattern with a specified replacement

Description

The REGEX_REPLACE() function is used to replace text within a given text string that matches a regular expression pattern with a specified replacement text. This is a powerful tool for text manipulation and data cleaning.

Syntax

REGEX_REPLACE(text, “pattern”, replacement)

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

  2. pattern: The regular expression pattern used to identify the text to be replaced.

  3. replacement: The text that you want to replace the matched text with.

Example

Table

ID
Original Text

1

Hello, World!

2

Example123: 456789

3

Remove! Symbols? From Text!

Function

REGEX_REPLACE(`Original Text`, "[^a-zA-Z0-9 ]+", "")

Results

REGEX_REPLACE (text)

Hello World

Example123 456789

Remove Symbols From Text

Last updated