REGEXP_COUNT

functionsupportedCore SQL functions

docs.snowflake.com ↗

String functions (regular expressions)

Returns the number of times that a pattern occurs in a string.

Syntax

supportedpartialnot supportednot scored

REGEXP_COUNT( <subject> ,
              <pattern>
                [ , <position>
                  [ , <parameters> ]
                ]
)

Parameters

NameRequiredDescription
subjectrequiredThe string to search for matches.
patternrequiredPattern to match. For guidelines on specifying patterns, see String functions (regular expressions).
positionoptionalNumber of characters from the beginning of the string where the function starts searching for matches. The value must be a positive integer. Default: 1 (the search for a match starts at the first character on the left)

Returns

Returns a value of type NUMBER. Returns NULL if any argument is NULL.

Usage notes

Collation details

When the 2026_04 BCR bundle is enabled, the function accepts arguments with a collation specification. The collation has no effect on pattern matching: matching is always case-sensitive unless you pass the i flag in the parameters argument.