extract_from_column
Extract specific patterns from data columns using regex capturing groups, enabling structured data parsing for email components, product codes, names, and date elements.
Instructions
Extract patterns from a column using regex with capturing groups.
Returns: ColumnOperationResult with extraction details
Examples: # Extract email parts extract_from_column(ctx, "email", r"(.+)@(.+)")
# Extract code components
extract_from_column(ctx, "product_code", r"([A-Z]{2})-(\d+)")
# Extract and expand into multiple columns
extract_from_column(ctx, "full_name", r"(\w+)\s+(\w+)", expand=True)
# Extract year from date string
extract_from_column(ctx, "date", r"\d{4}")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| column | Yes | Column name to extract patterns from | |
| pattern | Yes | Regex pattern with capturing groups to extract | |
| expand | Yes | Whether to expand multiple groups into separate columns |
Input Schema (JSON Schema)
{
"properties": {
"column": {
"description": "Column name to extract patterns from",
"type": "string"
},
"expand": {
"description": "Whether to expand multiple groups into separate columns",
"type": "boolean"
},
"pattern": {
"description": "Regex pattern with capturing groups to extract",
"type": "string"
}
},
"required": [
"column",
"pattern",
"expand"
],
"type": "object"
}