REGEXP_COUNT
Syntax
REGEXP_COUNT(str, pattern [, position [, match_param]])Overview
REGEXP_COUNT is a function that returns how many times a pattern given as a regular expression matches within 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. It can be of type TEXT or CHAR.
position
Arbitrary operation that returns a numeric value.
It specifies where to start pattern checking.
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_COUNT('abcabcabc','abc', 2);
regexp_count
--------------
2
(1 row)Last updated
