Use Formatter's Text action to break up your data into segments by using the Split Text transform. This is helpful when your data has a consistent delimiter and you need to use part of a field, or you want to break it up into smaller, separate segments.
Available on plans:
Free
Professional
Team
Enterprise
-
Split a full name into first and last name: Your trigger provides a full name like
Alex Johnson, but your CRM requires separate first and last name fields. Use Split Text with a space ([:space:]) as the separator, then select First for the first name and Last for the last name. Learn more about separating first and last names. -
Extract an ID from a URL: An app returns a URL like
gid://shopify/FulfillmentOrder/13435721712000, but a downstream step only needs the numeric ID. Use Split Text with/as the separator and select Last to get13435721712000. -
Get the latest message from an email thread: You receive an email thread with replies separated by a consistent delimiter like
On ... wrote:. Use Split Text with that delimiter as the separator and select First to get only the most recent message. -
Break a comma-separated list into line items: Your trigger provides a comma-separated list of tags like
urgent, billing, refund. Use Split Text with,[:space:]as the separator and select All (as Line-items) to create individual line items for each tag.
Choose the right text transform
Split Text is one of several text transforms available in Formatter. If your data does not have a consistent delimiter, a different transform may be a better fit:
| If you need to... | Use this transform | Learn more |
|---|---|---|
| Separate data at a consistent delimiter | Split Text | This article |
| Pull an email, phone number, or URL from mixed text | Extract Email Address, Extract Phone Number, or Extract URL | Extract data in Zaps |
| Find text using a custom pattern | Extract Pattern (regex) | Use regular expressions (regex) to find text in Zaps |
| Remove or swap specific characters (newlines, symbols) | Replace | Find and replace values in your Zaps |
| Remove leading or trailing spaces | Trim Whitespace | Remove extra text from your Zap data |
| Shorten text to a character limit | Truncate | Remove extra text from your Zap data |
1. Add a Formatter step
- In the Zap outline, click the Action step or the plus sign + to add a new action. 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.
You must use a specific syntax for special characters in the Separator field:
| 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 |
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 depends 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 (each as a separate line item) |
| All (as Separate Fields) | mango, passion fruit, pineapple, guava, mountain apple (each as a separate mappable field) |
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.
After testing, map the Formatter output in your later action steps, not the original field from your trigger. If you map the original field, the split is not applied. Learn more about mapping fields between steps.
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.
Troubleshoot split text
If your input starts with the separator character, the first segment will be empty. For example, splitting /path/to/file on / produces a blank first segment, then path, to, and file.
To get the value you need, select a different Segment Index (like Second or Last), or add a Replace step before splitting to remove the leading separator.
The Second to Last segment is the segment immediately before the last one. With only two segments, the Second to Last and First segments are the same value.
For example, with the input Taylor Lee split on a space:
-
First:
Taylor -
Second to Last:
Taylor -
Last:
Lee
With Sam De Luca split on a space:
-
First:
Sam -
Second to Last:
De -
Last:
Luca
Splitting names on a space works well for two-part names like Alex Johnson. For names with three or more parts (like Morgan Van Dijk), the Second segment returns Van, not Dijk.
For these cases, consider using Last for the last name instead of Second.
If later steps still show the original unsplit data, check that you mapped the Formatter output field, not the original trigger or action field. Learn more about mapping fields between steps.