Returns an array of all substrings that match a regular expression pattern. If the pattern does not match, returns an empty array.
| ||The string from which to extract substrings, based on a regular expression|
| ||An re2 regular expression for matching with the string.|
| ||Optional. Flags allow additional controls over characters used in the regular expression matching. If using multiple flags, you can include them in the same single-quote block without any separator character. |
Firebolt supports the following re2 flags to override default matching behavior.
SELECT REGEXP_MATCHES('ABC', '^([A-Z]+)');
SELECT REGEXP_MATCHES('Learning #Firebolt #REGEX', '#([A-Za-z0-9_]+)');
i flag causes the regular expression to be case insensitive. Without this flag, this query would only match and return
SELECT REGEXP_MATCHES('ABCdef', '^([A-Z]+)', 'i');
U flag causes metacharacters like
+ to return as few characters together as possible. Without this flag, this query would return
SELECT REGEXP_MATCHES('aPPLePie', '([A-Z]+)', 'U');