Use Formatter to split text in Zaps

Available on plans:

Free

Professional

Team

Enterprise

Use Formatter’s Text action to break up your data into segments by using the Split Text transform. This is helpful when you only want to use part of a field, or you want to break it up into smaller, separate segments.

Example

You can use the Split Text transform to separate first and last names to use in later steps.

1. Add a Formatter step

  • In the Zap editor, click the Action step. A dialog box will open.
  • In the search box, search for and select Formatter. The right sidebar will open to the Setup tab.
  • Click the Action event field to open the dropdown menu and select Text.
  • Click Continue to continue to the Configure tab.

2. Set up your transform

  • Click the Transform field to open the dropdown menu, then select Split Text.
  • In the Input field, manually enter the string you want to transform or map a field from a previous step.
  • In the Separator field, enter the value you want to separate on.
    • E.g. if there are commas between your values, type in a comma.
    • You must use a specific syntax for special characters, like spaces.
  • In the Segment Index field, select what output you want:
    • First: returns the first segment.
    • Second: returns the second segment.
    • Last: returns the last segment.
    • Second to Last: returns the second to last segment.
    • All (as Line-items): returns each segment as individual line-item values.
    • All (as Separate Fields): returns each segment as separate, mappable fields.
  • Click Continue to continue to the Test tab.
Note

You must use a specific syntax for special characters in the Find, Replace, and Default Value fields:

Syntax Special characters it replaces
[:space:] Use instead of space (\s) characters
[:tab:] Use instead of tab (\t) characters
[:newline:] Use instead of newline (\n) characters
[:return:] Use instead of carriage-return (\r) characters
Example

If you have a list of fruit: mango, passion fruit, pineapple, guava, mountain apple that you want to separate, you can enter ,[:space:] as the separator. Include both the comma and the space, so only the fruit is included in the output.

The output will depend on what option you select in the Segment Index field:

Segment Index Output
First mango
Second passion fruit
Last mountain apple
Second to Last guava
All (as Line-items)

mango

passion fruit

pineapple

guava

mountain apple

All (as Separate Fields)

mango

passion fruit

pineapple

guava

mountain apple

3. Test your action

  • Click Test step.
    • The Data out tab will display the transform output so you can confirm your string was formatted correctly.
    • If the new data is not what you expect, you can adjust the transform settings and retest the step again.
Tip

If you need to split text to meet token limits in AI steps, you can use the Split Text into Chunks for AI Prompt transform instead.

Was this article helpful?
2 out of 7 found this helpful