REGEXP_SUBSTR
Syntax
REGEXP_SUBSTR(str, pattern [, position [, occurrence [, match_param [, subexp]]]])
Overview
REGEXP_COUNT
is a function that searches for a pattern given as a regular expression within str and returns the corresponding string.
The type of the result is the same as the type of str.
Parameter
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.
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.
subexp
Arbitrary operation that returns a numeric value. It can be used from 0 to 9. subexp assigns numbers to each group enclosed in parentheses in pattern from left to right.
Example
SELECT REGEXP_COUNT('abcabcabc','abc', 2);
regexp_count
--------------
2
(1 row)
Last updated