- Print
- DarkLight
- PDF
The node supports commonly used string operations. There is a growing list of operations that can be used to fulfill various requirements. The selection operation reveals a dynamic set of inputs.
Before performing any operations, you must add the String Node to the graph and select it. Upon selection, an operations dropdown will appear at the right-bottom corner of the page.
Currently, the String Node provides six primary operations: Contains, Convert to String, Join, Regular Expression, Replace, and Trim.
Choose a required operation from the dropdown menu. Selecting an operation will reveal options corresponding to that operation.
In the future, additional operations will be available
Contains
The Contains operation checks if a specified value is present within an input string. This operation is useful for determining whether a particular word or phrase appears in a message, email, or other text. This operation is ideal for scenarios where you need to verify the presence of specific words or phrases in text-based content, with control over case sensitivity to ensure precise matching.
Input: String | Additional Input: Find | Output: Boolean (Single value) |
Example: Contains operation with and without match case.
String Node: Use Contains operation to match the defined value in the content.
Input Value: The text to be searched, such as a message or notification.
Find: The specific value or phrase you want to search for within the input text.
Match Case: Controls whether the search is case-sensitive.
If Match Case is enabled: Only matches text that exactly matches the case of the specified Find value. For example, searching for "Xponent" will not match "xponent" if Match Case is on.
If Match Case is disabled: Performs a case-insensitive search, so "Xponent" would match "xponent" regardless of capitalization.
Output: Specifies where the result of the operation (whether the value was found or not) will be stored.
Return Node: Define the return value destination.
Example 1: The output indicates that the input value doesn’t contain the defined value because it is in lowercase, as the Match Case is turned on.
Example 2: The output indicates that the input value contain the defined value even it is in lowercase, as the Match Case is turned off.
Convert to String
The Convert to String operation converts all input data to a string. This is useful when the input type is uncertain, such as JSON or numbers.
Input: Input | Additional Input: N/A | Output: Single String |
Example: Convert to string operation
Insert a set node and set the value of input 1 to "56".
For Convert to String operation, define Input Value to Input 1 and Output to output 2.
For Trim operation, define Input Value to Output 2 and Output to output 1.
The output will display the input value successfully converted to a string.
Join
The Join operation concatenates multiple input strings. You can also specify a separator to be used between the strings. The Input 1 and Input 2 fields are mandatory to provide the output. For instance, it can be used to join first name and last name for personalized notifications.
Ensure all the inputs are strings while using join operation, or convert non-string elements to strings first using the Convert to String operation.
Users can join multiple words by chaining multiple nodes with join operations in the String Node.
Input: Two or more inputs | Additional Input: Separator (Dynamic input) | Output: Single String |
Example: Join operation.
Insert a first set node and set the value of input 1 to "Xponent".
Insert a second node and set the value of input 2 to "library".
For first join operation, define below values:
Input Value 1: Define input 1 value “Xponent”
Input Value 2: Define literal value (hyphen)
Input Value 3: Define input 2 value “library”
Separator: Define literal value (Widespace)
Output: Define output 1
Insert a third node and set the value of input 3 to "testing completed.".
For second join operation, define below values:
Input Value 1: Define output 1 value “Xponent - library”
Input Value 2: Define input 3 value (testing completed.)
Input Value 3: optional
Separator: Define literal value (Widespace)
Output: Define output 2
The output you would receive as "Xponent - library testing completed.".
Regular Expression
The Regular Expression operation extract specific patterns or sequences from an input string using regex (regular expressions). This operation is useful for isolating targeted parts of text, such as email usernames, specific words, or character sequences, based on a defined pattern.
This operation is ideal for use cases requiring dynamic extraction, such as obtaining usernames from email addresses, filtering specific keywords, or identifying sequences in larger text blocks.
Input: Single String | Additional Input: Regex Pattern (dynamic input), Type of operation (Extract All, extract first appearance match) | Output: Dynamic Output Single String, (Blank string is regex doesn't match) List, Boolean |
Example: Regular Expression operation to extract the defined values.
String Node (Regular Expression Operation):
Input Value: Set to the literal value "john.doe@example.com".
Regex Pattern: Set to the literal value "(\w+)\.(\w+)". This pattern will match the format of the email, where (\w+) captures a sequence of word characters (like "john" and "doe") separated by a period.
Function:
Extract First Occurrence: This option will extract only the first match based on the provided regex pattern, which in this case will capture "john" and "doe" as separate groups.
Extract All: This option will extract all occurrences matching the pattern in the input. If there are multiple matches, it will return each match found.
Output: Set the output destination to "output".
Return Node:
Return Value: Set to the output destination "output".
Example 1: Extract First Occurrence function
Example 2: Extract All function
Here's a breakdown of how other examples work with different regex patterns and functions:
Example 3: Extracting a Username Before "@" (Matching Pattern)
Input Value: "abc@xyz.com"
Regex Pattern: “^(.+)@” This pattern captures any characters (.+) at the beginning (^) until the "@" symbol.
Function: Extract All
Output will be: "abc@"
Since Extract All is used, it captures the portion before the "@" symbol, giving "abc@".
Example 4: Extracting a Username Before "@" (Non-matching Pattern)
Input Value: "abc.xyz.com"
Regex Pattern: “^(.+)@” This pattern looks for characters at the start (^) of the string followed by "@".
Function: Extract First Occurrence. This option extracts only the first match found, if any.
Output: null
Since there is no "@" in the input "abc.xyz.com", the pattern does not match, resulting in null.
Replace
The Replace operation substitutes specified words or placeholders within an input string with a chosen replacement. It requires an input string (like a message or template), the word or placeholder to find, and the replacement word. The final output displays the text with the specified replacements applied. This operation is ideal for dynamically customizing messages, emails, or templates for personalized communication.
Input: String | Additional Input: Find, Replace with | Output: Updated string |
Example: Replace operation with join operation input.
Set Nodes: Use the Set nodes to provide the input values.
First Set Node: Set the value of Input 1 to "Hello".
Second Set Node: Set the value of Input 2 to "username,".
Third Set Node: Set the value of Greeting to "how are you?".
String Node: Use the Join operation to combine the inputs with the following values:
Input Value 1: Set to Input 1 value "Hello".
Input Value 2: Define as the literal value "username,".
Input Value 3: Set to Input 2 value "how are you".
Separator: Set as the literal whitespace " ".
Output: Define output to "Welcome".
String Node: Use the Replace operation to replace the inputs with the following values:
Input Value: Set to "Welcome".
Find: Set the find value to "username".
Replace with: Set the replacement value to "Atul".
Output: Define output to "Replace Output".
Return Node: Use a Return node with the following value:
Return Value: Set to "Replace Output".
The output you would receive as "Hello Atul, how are you?"
Trim
The Trim operation removes whitespace from both ends of a string and returns a new string. It does not modify the original string. If the provided input is not a string, an error will be thrown.
Input: Single String | Additional Input: N/A | Output: Single String |
The trim operation reacts differently in two scenarios with the provided string and non-string values, as mentioned below.
Example: Using Input - String and Non-string value
Scenario 1: Input value is String value
Insert a set node and set the value of input 1 to " Xponent ".
For trim operation, define Input Value to Input 1 and Output to output 1.
Output will be an "Xponent"
Scenario 2: Input value is Non-string value
For trim operation, define Input Value to Input 1 and Output to output 1.
Output will display an error: Input value(s) does not contain string data