---
title: "regexp_extract function in Strata | Oplema"
description: "Return the part of text that matches a regular expression, or empty text if there is no match. Use it in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/regexp-extract"
updated: "2026-11-04"
---

# regexp\_extract

Return the part of text that matches a regular expression, or empty text if there is no match. An optional constant group number picks a capturing group, and regex options can follow.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **VARCHAR**.

### Expression

```
regexp_extract('ABC', '([a-z])(b)', 1, 'i')
```

### Result

```
'A'
```

To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | A |

## Arguments and types

```
regexp_extract(string, regex, name_list, options)
```

**string**

Text

**regex**

Text

**group**

Number

**options**

Text

**name\_list**

List

Supported signatures (5)

```
regexp_extract(string: VARCHAR, regex: VARCHAR) → VARCHAR
regexp_extract(string: VARCHAR, regex: VARCHAR, group: INTEGER) → VARCHAR
regexp_extract(string: VARCHAR, regex: VARCHAR, group: INTEGER, options: VARCHAR) → VARCHAR
regexp_extract(string: VARCHAR, regex: VARCHAR, name_list: VARCHAR[]) → VARCHAR
regexp_extract(string: VARCHAR, regex: VARCHAR, name_list: VARCHAR[], options: VARCHAR) → VARCHAR
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[regexp\_extract\_all

Find every non-overlapping match of a regular expression in text and return them as a list. An optional group number picks a capturing group, and regex options can follow.

](https://oplema.com/docs/strata/functions/regexp-extract-all)[regexp\_matches

Check whether text contains a match for a regular expression. An optional argument sets regex options.

](https://oplema.com/docs/strata/functions/regexp-matches)[regexp\_full\_match

Check whether all of the text matches a regular expression. An optional argument sets regex options.

](https://oplema.com/docs/strata/functions/regexp-full-match)[string\_split\_regex

Split text at each match of a regular expression and return the parts as a list. An optional argument sets regex options.

](https://oplema.com/docs/strata/functions/string-split-regex)

[Browse patterns](https://oplema.com/docs/strata/functions#patterns) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/text.html#regexp_extractstring-regex-group-options)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
