Regex Capture
Extract regex capture groups into new columns
What It Does
Regex Capture pulls structured pieces out of a free-text column using a regular expression with capture groups. Each group becomes its own new column. Common uses: ZIP codes, invoice numbers, country codes, domain names. If the pattern doesn't match a row, the capture columns for that row are NULL.
How to Use It
Opening the Panel
Click the + button in the toolbar or press the operation picker, then search for "Regex Capture". It's in the Transform group.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
Source column | Column select | Yes | Text column to extract from |
Pattern | Regex string | Yes | DuckDB regex (RE2) with parenthesised capture groups |
Output columns | List of names | Yes | One name per capture group, in order |
SQL generated under the hood
SELECT *, regexp_extract(address, '(\d{5})-(\d{4})', 1) AS zip5, regexp_extract(address, '(\d{5})-(\d{4})', 2) AS zip_plus4 FROM data
Related Operations
- Update Values - Update column values with expression
- Find & Replace - Search and replace values in a column
- Text Transform - Transform text: uppercase, lowercase, trim