ComfyUI > Nodes > ComfyUI_StringEssentials > String Contains Any

ComfyUI Node: String Contains Any

Class Name

StringContainsAny

Category
utils/StringEssentials
Author
bradsec (Account age: 4314days)
Extension
ComfyUI_StringEssentials
Latest Updated
2026-03-09
Github Stars
0.03K

How to Install ComfyUI_StringEssentials

Install this extension via the ComfyUI Manager by searching for ComfyUI_StringEssentials
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_StringEssentials in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

String Contains Any Description

Determines if an input string contains any specified substrings, returning a boolean and match.

String Contains Any:

The StringContainsAny node is designed to help you determine if a given input string contains any of a list of specified substrings. This node is particularly useful when you need to check for the presence of multiple keywords or phrases within a text, allowing you to quickly identify if any of the specified substrings are present. It offers flexibility by allowing you to perform case-sensitive or case-insensitive searches, making it adaptable to various text processing needs. By returning both a boolean result and the first matched substring, this node provides a straightforward way to verify and retrieve relevant text segments, enhancing your ability to manage and manipulate strings effectively.

String Contains Any Input Parameters:

input_string

This parameter represents the main string in which you want to search for the presence of any specified substrings. It is the primary text that will be scanned, and its content directly impacts the node's execution as it determines the context in which the substrings are checked. There are no minimum or maximum values for this parameter, as it can be any string of text.

substrings

This parameter allows you to specify the substrings you want to search for within the input_string. You can enter multiple substrings, each on a new line, which the node will check against the input_string. The presence of any of these substrings will result in a positive match. This parameter is flexible, allowing you to input as many substrings as needed, and it defaults to an empty string if not specified.

match_case

This boolean parameter determines whether the search should be case-sensitive. When set to True, the search will consider the case of the characters, meaning "Anime" and "anime" would be treated as different substrings. When set to False, the search will ignore case differences, treating "Anime" and "anime" as equivalent. The default value for this parameter is False, allowing for case-insensitive searches unless specified otherwise.

String Contains Any Output Parameters:

contains_any

This boolean output indicates whether any of the specified substrings were found within the input_string. A value of True means that at least one substring was detected, while False indicates that none of the substrings were present. This output is crucial for quickly assessing the presence of keywords or phrases in the text.

matched_string

This output provides the first substring that was found within the input_string. If a match is found, this output will contain the exact substring that triggered the positive result. If no match is found, it will return an empty string. This output is valuable for identifying which specific substring was detected, allowing for further processing or analysis.

String Contains Any Usage Tips:

  • Use the match_case parameter to control the sensitivity of your search, enabling you to tailor the node's behavior to your specific needs, whether you require strict case matching or a more flexible approach.
  • When dealing with multiple substrings, ensure each is entered on a new line in the substrings parameter to maximize the node's effectiveness in detecting any of the specified phrases.

String Contains Any Common Errors and Solutions:

Empty input string

  • Explanation: The input_string is empty, so no substrings can be found.
  • Solution: Ensure that the input_string contains text before executing the node.

Empty substrings

  • Explanation: The substrings parameter is empty, meaning there are no substrings to search for.
  • Solution: Provide at least one substring in the substrings parameter to perform a meaningful search.

Substrings with only whitespace

  • Explanation: Substrings consisting solely of whitespace are ignored, potentially leading to unexpected results.
  • Solution: Ensure that each substring contains meaningful text and is not just whitespace.

String Contains Any Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_StringEssentials
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.