Overview
The Transform Text action enables you to perform various text manipulation operations on input text using programmatic methods. It provides a range of transformation options like replacing text using regular expressions, splitting text into an array based on a delimiter, calculating text length, truncating text to a specified character count, converting text to uppercase or lowercase, and joining array elements into a single text string. This action is useful for common text processing tasks that are better suited for programmatic operations rather than relying on AI generation. It allows you to clean up, reformat, and manipulate text inputs as needed before or after using other AI-powered actions.
Inputs
Text to transform - The input text that you want to apply the transformation to.
"Hello World"
Choose a Transformation - The dropdown field to select the transformation type. Choices include:
Replace Text: Finds and replaces text based on inputs.
Find all instance of: This input holds any characters or words you want to replace with other words or characters
*Replace with: *****This input holds the characters or words that should replace the text being found in the Find all instance of input.
Split Text: Splits given text based on a given delimiter
Delimiter - The character(s) used to split the input text into an array. For example, using
,
would mean that the Text to transform would be split on every appearance of the comma. While there are several predefined delimiters to choose from, if you select Custom for the delimiter, you’ll be prompted to enter customer delimiting characters in the Custom Delimiter input.
Calculate Number of Characters: Returns the length of the input text in number of characters
Truncate text: Shortens text to the number of characters provided
Number of characters - The maximum number of characters to truncate/limit the input text to. (e.g.
10
)
Convert to uppercase: Returns the full provided text with all characters converted to uppercase
Convert to lowercase: Returns the full provided text with all characters converted to lowercase
Join Array to Text: Takes in an array
Array to join - programmatic array - An array of text items that you want to join together into a single string of text.
["item1", "item2", "item3"]
Delimiter - The character(s) used to split the input text into an array. For example, using
,
would mean that the Text to transform would be split on every appearance of the comma. While there are several predefined delimiters to choose from, if you select Custom for the delimiter, you’ll be prompted to enter customer delimiting characters in the Custom Delimiter input.
Outputs
In most cases, the output is text transformed according to the operation selected. However, for the Split Text operation specifically, the output is an array of text chunks rather than a single string. Additionally, for the Calculate Number of Characters operation, the output is simply a numeric character count rather than transformed text.
Example Split Text transformation output:
[ { "chunk": "The quick brown fox" }, { "chunk": "jumped over the lazy dog" } ]
Troubleshooting
Join Array to Text -
Error with join
- If you see “Error with join” as an error, make sure the Array to join input contains a valid array. A valid array contains two brackets[]
that looks like this:
Related Actions
Extract Data from Text - This action evaluates a block of text to extract multiple pieces of information in a structured format like JSON. You would use this action if you want to get a list of data points from a given text input.
Generate Text - This action generates new text based on a prompt or set of instructions you provide. You would use this action if you need to create new text content, which you may then want to transform further using the Transform Text action.