Skip to main content
Returns an array that contains all matches of a <pattern> within the given <expression>. If the pattern does not match, returns an empty array. If you want return the first match of <pattern> within the <expression>, use REGEXP_EXTRACT.

Return Types

ARRAY<TEXT>

Examples

Rows: 1Execution time: 6.17ms

Despite using subgroups in the regular expression, each full match will be returned as the optional <index> argument is not set (the default value 0 is used instead).

Rows: 1Execution time: 5.42ms

The regular expression contains two subgroups which allows us to set the <index> argument to something between 0 and 2. Every other value will cause an exception to be thrown. Setting <index> to 0 would cause that all full matches ["#REGEX", "#Firebolt"] are returned (same behavior as not setting this value, see the example above), while a 2 would return the second subgroup of each match ["EGEX", "irebolt"].

Rows: 1Execution time: 5.81ms