Skip to main content

REGEXP_COUNT function

Returns the number of times str matches the regular expression pattern pattern.

Note

CeloSQL uses Java regex patterns.

Syntax

REGEXP_COUNT( str, pattern )

Arguments

  • str: A VARCHAR expression to be matched

  • pattern: A VARCHAR literal with a regular expression pattern

Returns

A BIGINT.

Examples

> SELECT regexp_count('123 hello 456 world 789', '(\d+)');
3

> SELECT regexp_count('hello, world', 'a|bd');
0