Text
Split a string to multiple columns or a list.
Split text strings on certain characters. The text can be split into either multiple columns or a list.
Parameters
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| I/O | ||||
input | Name of the column to be split. | string | — | Yes |
output | Name of the output column(s) If a single column is provided, the results will be returned as a list If multiple columns are listed, the results will be separated into the columns. If omitted, will overwrite the input. | string, array, null | null | No |
| Options | ||||
char | Set the character(s) to split on. Default comma (,) Can also prefix with "regex:" to split on a pattern. | string | "," | No |
element | Select a specific element or range after splitting using slicing syntax. e.g. 0, ":5", "5:", "2:8:2". | string, integer, null | null | No |
inclusive | If true, include the split character in the output. Default False. | boolean | false | No |
skip_empty | Whether to skip empty values. | boolean | false | No |
| Formatting | ||||
pad | Choose whether to pad to ensure a consistent length. Default true if outputting to columns, false for lists. | boolean, null | null | 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:
- split.text:
input: Column1
output: Column2
char: ', '
| Column1 |
|---|
| Hello, Wrangles! |
| Column2 |
|---|
| ['Hello', 'Wrangles!'] |
# Split on x, case insensitive.
wrangles:
- split.text:
input: Col1
output: Col2
char: 'regex:(?i)x'
| Col1 |
|---|
| 1x2 |
| 1X2 |
| Col2 |
|---|
| ['1', '2'] |
| ['1', '2'] |
wrangles:
- split.text:
input: Column1
output: Column2
char: ', '
element: 0
| Column1 |
|---|
| Hello, Wrangles! |
| Column2 |
|---|
| Hello |
wrangles:
- split.text:
input: Col
output: Col* # Optional
char: ', '
| Col |
|---|
| Hello, Wrangles! |
| Col1 | Col2 |
|---|---|
| Hello | Wrangles! |
wrangles:
- split.text:
input: Col
output:
- Col 1
- Col 2
- Col 3
char: ', '
| Col |
|---|
| Wrangles, are, Cool! |
| Col 1 | Col 2 | Col 3 |
|---|---|---|
| Wrangles | are | Cool! |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 65 |
| Catalog key | split.text |
| Recipe key | split.text |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | split |
| Documentation group | split |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.split.text |
| Legacy UUID | e76e43f7-d129-4bf8-87b4-a304a378b130 |
Sources