> ## Documentation Index
> Fetch the complete documentation index at: https://learn.workflow.dog/llms.txt
> Use this file to discover all available pages before exploring further.

# Split Text

> Break a string into a list using literal text or a regex separator.

The **Split Text** action divides a string wherever a separator occurs and
returns the pieces in order. Choose between a literal separator and a reusable
regular expression.

## Inputs

| Input                 | Type               | Required  | Description                                     |
| --------------------- | ------------------ | --------- | ----------------------------------------------- |
| **Text**              | String             | Yes       | The text to split.                              |
| **Use Regex**         | Boolean            | Yes       | Shows the literal or regex separator input.     |
| **Separator Text**    | String             | Sometimes | Exact separator used when **Use Regex** is off. |
| **Separator Pattern** | Regular expression | Sometimes | Pattern used when **Use Regex** is on.          |

## Outputs

| Output    | Type            | Description                                            |
| --------- | --------------- | ------------------------------------------------------ |
| **Split** | List of strings | The text pieces before, between, and after separators. |

## Examples

<Tabs>
  <Tab title="Literal separator">
    Split `red,green,blue` with a **Separator Text** of `,` to return:

    ```json theme={null}
    ["red", "green", "blue"]
    ```

    Connect **Line Break** as the separator to split text into lines.
  </Tab>

  <Tab title="Regex separator">
    Split `red, green; blue` with a pattern of `\s*[,;]\s*` to accept either
    punctuation mark and discard nearby spaces:

    ```json theme={null}
    ["red", "green", "blue"]
    ```
  </Tab>
</Tabs>

<Note>
  A separator at the beginning or end produces an empty first or last item.
  Adjacent separators produce empty items between them.
</Note>

<Warning>
  Capturing parentheses in a regex separator add the captured separator text to
  the output list. Use non-capturing groups such as `(?:,|;)` when those values
  should not become list items.
</Warning>
