REGEXP_REPLACE()

Scalar. Returns a given string with the first occurrence of a match for a POSIX regular expression pattern replaced with a second, specified string.

Syntax

REGEXP_REPLACE( string, regex, replacement )
Parameters

string

A string.

regex

A POSIX regular expression pattern. This pattern is limited to the Perl syntax.

replacement

A string to replace the part of string that matches regex.

Data Types

Return

string

regex

replacement

String

String

String

String

Usage

If string does not contain a match for regex, the function returns string with no replacements. If regex is not a valid regular expression, the function returns NULL.

Example

INSERT INTO OutStream
SELECT 
   REGEXP_REPLACE(InStream.src, InStream.regexp, InStream.replace_str),
   InStream.src,
   InStream.regexp,
   InStream.replace_str
FROM InStream;