Regex
Extract matches or specific capture groups using regex.
Extract single values, matches, or specific capture groups using regex.
Parameters
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| I/O | ||||
input | Name of the input column(s). | string, integer, array | — | Yes |
output | Name of the output column(s). | string, array | — | Yes |
| Options | ||||
find | Pattern to find using regex. | string | — | Yes |
| Formatting | ||||
output_pattern | Specifies the format to output matches and specific capture groups using backreferences (e.g., \1, \2). Default is to return entire matches. Example: For a regex pattern r'(\d+)\s(\w+)' and output_pattern = '\2 \1', with input '120 volt', the output would be 'volt 120'. | string, null | null | No |
first_element | Get the first element from results. | boolean | false | No |
output_format | Format of the extract output. | string, null; one of:
| null | No |
char | Character to use when output_format is concatenate. | string | ", " | No |
| Conditions | ||||
if | Condition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}. | string | — | No |
where | Filter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'. | string | — | No |
where_params | Values used with where for parameterized criteria. Uses SQLite placeholder syntax such as ? or :name. | array, object | — | No |
Examples
wrangles:
- extract.regex:
input: Product
output: GPM
find: \d\.?\d? ?gpm
| Product |
|---|
| 3.4 gpm water pump |
| 2gpm water pump |
| GPM |
|---|
| 3.4 gpm |
| 2gpm |
wrangles:
- extract.regex:
input: Product
output: GPM
find: (\d\.?\d?) ?gpm
output_pattern: \1 Gallons Per Minute
| Product |
|---|
| 3.4 gpm water pump for 5.5 gallon tank |
| 2gpm water pump for 2 gal tank |
| GPM |
|---|
| 3.4 Gallons Per Minute |
| 2 Gallons Per Minute |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 30 |
| Catalog key | extract.regex |
| Recipe key | extract.regex |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | extract |
| Documentation group | extract |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.extract.regex |
| Legacy UUID | 9aa0253a-4b70-4737-832c-964e15967289 |
Sources