REGEXP_EXTRACT() returns the first part of a string that matches a regular expression. Given a group number, it returns only what that pair of parentheses in the pattern matched, which is the usual way to pull one piece out of a value: the digits of an invoice number, the domain of an email address, the year in a reference. When nothing matches, the result is an empty string.
REGEXP_EXTRACT(string, pattern [, group [, options]]) REGEXP_EXTRACT() returns a character string
// The first match
REGEXP_EXTRACT('foo123bar456', '[0-9]+') = '123'
// A group number: what that pair of parentheses matched
REGEXP_EXTRACT('a12b34', '([a-z])([0-9]+)', 1) = 'a'
REGEXP_EXTRACT('a12b34', '([a-z])([0-9]+)', 2) = '12'
// Group 0 is the whole match
REGEXP_EXTRACT('a12b34', '([a-z])([0-9]+)', 0) = 'a12'
// Nothing matches: an empty string
REGEXP_EXTRACT('abc', '[0-9]+') = ''
// +? takes as little as it can
REGEXP_EXTRACT('<a><b>', '<.+?>') = '<a>'
REGEXP_EXTRACT('<a><b>', '<.+>') = '<a><b>'
// Ignoring case
REGEXP_EXTRACT('ABC', '(b)', 1, 'i') = 'B'
'[0-9]+[^0-9]+([0-9]+)' with group 1 is the second number in a string.(?i) at the start of the pattern ignores case, and so does 'i' as the fourth argument, after the group number.\d, \w and \s stand for a digit, a letter, digit or underscore, and a blank, of the unaccented alphabet.