> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# REGEXP_EXTRACT_ALL

> Returns the selected capture group from each regular-expression match.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

NULL value or pattern returns NULL. A NULL group index returns NULL with a constant pattern, but is not reliably propagated with a pattern column.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
regexp_extract_all(value, pattern [, group])
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING | Yes | The string to search. |
| pattern | STRING | Yes | The regular expression. |
| group | INTEGER | No | Capture-group number. Use a non-NULL constant integer. 0 selects the entire match. Default: 1. |

## Returns

* Type: ARRAY\<STRING>
* Possible values: Matching capture text; an empty array when nothing is captured.
* NULL behavior: NULL value or pattern returns NULL. A NULL group index returns NULL with a constant pattern, but is not reliably propagated with a pattern column.
* Shape: One string for each participating selected capture.
* Ordering: Match encounter order.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT regexp_extract_all('a1b2', '([0-9])', 1) AS "value", regexp_extract_all('abc', '([0-9])', 1) AS no_match;
```

| value | no\_match |
| - | - |
| \["1","2"] | \[] |

### NULL scalar group

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT regexp_extract_all('a1b2','([0-9])',CAST(NULL AS INT)) AS "value";
```

| value |
| - |
| NULL |

### Default capture group and full match

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT
  regexp_extract_all('a1b2', '([a-z])([0-9])') AS default_group,
  regexp_extract_all('a1b2', '([a-z])([0-9])', 0) AS full_match;
```

| default\_group | full\_match |
| - | - |
| \["a","b"] | \["a1","b2"] |

## Limitations

* Use a constant capture-group index. A group column is not evaluated independently for each row.
* Invalid regular expressions raise an error.
* Negative or out-of-range group indexes return an empty array.
* A NULL group index is not reliably propagated when pattern is a column; use a non-NULL constant index.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.