Skip to main content
Returns the first match of <pattern> within the <expression>. If the pattern does not match, returns NULL. If you want to extract all matches, use REGEXP_EXTRACT_ALL.

Syntax

Parameters

Return Types

TEXT

Examples

Rows: 1Execution time: 6.17ms

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

Rows: 1Execution time: 5.37ms

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 the full match "#Firebolt 2024" to be returned (same behavior as not setting this value, see the example above), while a 2 would return the second subgroup "2024".

Rows: 1Execution time: 5.12ms