REGEXP_COUNT() returns the number of times a regular expression matches in a string. Use it to count what a value holds: the digits in a phone number, the separators in a code, the order numbers named in a description. To test only whether the pattern matches, use REGEXP_MATCHES(); to read the match itself, use REGEXP_EXTRACT().
REGEXP_COUNT(string, pattern) REGEXP_COUNT() returns an integer value
REGEXP_COUNT('a1b22c333', '[0-9]+') = 3
REGEXP_COUNT('a1b22c333', '[0-9]') = 6
REGEXP_COUNT('abc', '[0-9]') = 0
// Matches do not overlap
REGEXP_COUNT('aaaa', 'aa') = 2
// (?i) at the start of the pattern ignores case
REGEXP_COUNT('ABCABCAXYaxy', 'A.') = 3
REGEXP_COUNT('ABCABCAXYaxy', '(?i)A.') = 4
// Rows whose contact field holds more than one e-mail address
REGEXP_COUNT(contact, '@') > 1
// How many purchase orders a description names
REGEXP_COUNT(description, 'PO-[0-9]+')
(?i) at the start of the pattern ignores case. REGEXP_COUNT() takes no options argument.x*, is counted once at every place it does so: REGEXP_COUNT('abc', 'x*') is 4. Write x+ to count the places an x stands.\d, \w and \s stand for a digit, a letter, digit or underscore, and a blank, of the unaccented alphabet. An accented letter counts as one character, but not as a \w.