Connectors / Helper / Text Helper

Text Helper

Text Helper

Manipulate text using common utilities such as splitting, upper casing and truncating


The Text Helper connector allows you to manipulate text results from connectors and triggers, primarily to extract and format information so that it can be passed to a connector in a suitable format.

'Concatenate' Example

The following screenshot shows a text helper which is using the concatenate function to pull the 'email address' and 'suggestion' fields from the form trigger and feed it in to the first Slack connector:

This will result in has suggested: this is my suggestion being sent to the first Slack connector, which can use the $.steps.text-helpers-1.result variable:

The 'Contains' operation

The Contains operation is useful for checking if a keyword is contained in a piece of text being returned by another connector.

It is however limited to only one word or phrase. Please see the example on our Useful scripts page for instructions on how to check for multiple keywords or phrases.

Using 'Regular Expressions'

'Replace' Example 1: Replace characters in phone number

This example will use regular expressions within the Replace operation to demonstrate the power of this way of generating the pattern. For instance, when dealing with phone numbers some systems don\'t allow special characters, apart from the + in the prefix. Taking the example of US phone numbers, which are formatted as '+1 (564) 654-5464'. We cannot simply use the Remove special characters operation in the Text Helper, as this will remove all special characters, leaving '15646545464'. Instead, we use a 'Regular Expression' pattern in the Replace operation to remove just the characters of interest. By setting the Pattern to [()\s-] and the Replacement to an empty string, we can remove just the characters we need to remove:

The output of this operation is

"result": "+15646545464"

Note you can explore more regular expression examples at this website: You will notice that the regular expression flags are explicit options in the input panel in Tray. For instance, the Replace all patterns? field toggles the g flag on the expression, and the Case sensitive? field toggles the i flag.

'Replace' Example 2: Remove empty fields from a text body

Take another example. In this example, we have a body of text which has been populated with the values that come from a random record. Let\'s say this formatted body of text is as follows:

First Name: Example
Last Name:

Ideally, we want to remove any empty fields, such as the Last Name field, which have no value. This can be achieved very easily by using the Text Helper\'s Replace operation, using a regular expression pattern. By specifying the pattern ([^:\\n]+): *\\n, we can target any line that starts with a label (any text preceding a colon), that has no value after this colon. By specifying the Replacement value as an empty string, we can transform the above body of text into:

First Name: Example

All Operations

Latest version: