REGEXP_REPLACE

Syntax

REGEXP_LIKE(str, pattern [, replace_str [, position [, occurrence [, match_param]]]])

Overview

REGEXP_COUNT is a function that searches for a pattern given as a regular expression within str and replaces it with another string.

Parameter

Parameter
Description

str

Arbitrary operation that returns a string. It can be of type TEXT or CHAR.

pattern

Arbitrary operation that returns a string written as a regular expression. Arbitrary operation that returns a string. It can be of type TEXT or CHAR.

replace_str

Arbitrary operation that returns a string. It can be of type TEXT or CHAR.

position

Arbitrary operation that returns a numeric value.

It specifies where to start pattern checking.

occurrence

Arbitrary operation that returns a numeric value. It specifies how many times to check the pattern.

match_param

Arbitrary operation returning a string. It sets how to check for patterns. The following values can be used, and multiple values can be used simultaneously.

  • i : It is not case sensitive.

  • c : It is case sensitive.

  • n : Periods (.) include line breaks.

  • m : The input string is more than one line.

  • x : This ignores whitespace characters in the pattern.

Example

SELECT REGEXP_REPLACE('aaaaaaa','([[:alpha:]])', 'x');
 regexp_replace 
----------------
 xxxxxxx
(1 row)

Last updated