Split
Synopsis
Splits a string field into an array using a specified separator pattern.
Schema
split:
- field: <ident>
- separator: <char>
- description: <text>
- if: <script>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- preserve_trailing: <boolean>
- tag: <string>
- target_field: <ident>
Configuration
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Field containing the string to split |
separator | Y | - | Character or regular expression pattern to use as separator |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | See Handling Failures |
ignore_missing | N | false | If true , quietly exit if field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
preserve_trailing | N | false | If true , preserve empty trailing values |
tag | N | - | Identifier |
target_field | N | field | Field to store the resulting array |
Details
When splitting strings, the processor supports both basic string separators and advanced regular expression patterns. The result is stored as an array either in the original field or in a specified target field.
note
Regular expressions are cached for better performance when reused.
warning
The field must contain a string value, otherwise the processor will fail unless ignore_failure
is set to true
.
Examples
Basic
Split string using comma separator... |
|
to create an array of values: |
|
Trailing Values
Enabling |
|
keeps empty trailing elements: |
|
Regular Expressions
Splitting on multiple whitespace characters... |
|
treats consecutive spaces as one separator: |
|
Target Field
Storing the result in a new field... |
|
preserves the original: |
|