Skip to main content

Regex

Extract matches or specific capture groups using regex.

Extract single values, matches, or specific capture groups using regex.

Parameters​

NameDescriptionAccepted ValuesDefaultRequired
I/O
inputName of the input column(s).string, integer, array—Yes
outputName of the output column(s).string, array—Yes
Options
findPattern to find using regex.string—Yes
Formatting
output_patternSpecifies 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, nullnullNo
first_elementGet the first element from results.booleanfalseNo
output_formatFormat of the extract output.string, null; one of:
  • list
  • columns
  • concatenate
nullNo
charCharacter to use when output_format is concatenate.string", "No
Conditions
ifCondition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}.string—No
whereFilter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'.string—No
where_paramsValues 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
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID30
Catalog keyextract.regex
Recipe keyextract.regex
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
Namespaceextract
Documentation groupextract
AliasesNone
Runtime symbolwrangles.recipe_wrangles.extract.regex
Legacy UUID9aa0253a-4b70-4737-832c-964e15967289

Sources