Text Includes
Uncontrolled node
Overview
The Text Includes node checks whether a specific pattern (substring) exists within a given piece of text. It outputs a boolean value (true or false) depending on whether the pattern is found.
This node is useful for conditional logic, filtering text, or validating content without needing to know the exact position of the pattern.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Text | Text | The source text to search within. | - |
| Pattern | Text | The substring or pattern to search for within the text. | - |
Outputs
| Output | Type | Description |
|---|---|---|
| Includes | Boolean | Returns true if the pattern is found within the text, otherwise returns false. |
Runtime Behavior and Defaults
The Text Includes node is an uncontrolled node, meaning it runs automatically whenever its inputs change. It does not require an event trigger to execute.
- Case Sensitivity: The search is case-sensitive. For example, searching for
"Hello"in"hello world"will returnfalse. - Empty Strings: If the pattern is an empty string, the node will return
true(as an empty string is technically included in every string). - Invalid Inputs: If either input is not a valid string, the node defaults to outputting
false. - Partial Matches: The node uses JavaScript's
String.prototype.includes()method, which checks for the exact substring anywhere within the text.
Example Usage
Checking for a Domain in an Email
Use the Text Includes node to verify if an email address contains a specific domain:
- Connect an email string to the Text input.
- Set the Pattern input to
"@gmail.com". - The Includes output will be
trueif the email is a Gmail address, allowing you to branch your workflow using an If node.
Filtering a List of Comments
Combine with the Filter List node to remove comments containing specific words:
- Use Text Includes inside a Filter List pattern to check if each comment contains the word
"spam". - Invert the result (using a Not operation or similar logic) to keep only comments that do not include the pattern.