ComfyUI > Nodes > ComfyUI-CoCoTools > Regex Find

ComfyUI Node: Regex Find

Class Name

RegexFindNode

Category
COCO Tools/String Tools
Author
Conor-Collins (Account age: 431days)
Extension
ComfyUI-CoCoTools
Latest Updated
2025-03-05
Github Stars
0.03K

How to Install ComfyUI-CoCoTools

Install this extension via the ComfyUI Manager by searching for ComfyUI-CoCoTools
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-CoCoTools 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

Regex Find Description

Extract specific text patterns using regular expressions for data cleaning and text analysis.

Regex Find:

The RegexFindNode is a powerful tool designed to help you extract specific patterns of text from a larger string using regular expressions. This node is particularly useful when you need to identify and isolate parts of a text that match a certain pattern, such as extracting email addresses, dates, or any custom pattern you define. By leveraging the capabilities of regular expressions, this node allows you to perform complex text searches and manipulations with ease. Its primary function is to search through the provided input string and return the first occurrence of the pattern specified by the regular expression. This can be incredibly beneficial for tasks that involve data cleaning, text analysis, or any scenario where precise text extraction is required.

Regex Find Input Parameters:

input_string

The input_string parameter is the text in which you want to search for a pattern. It is a multiline string, meaning it can contain multiple lines of text, allowing for comprehensive searches across large blocks of text. The default value is an empty string, which means if no text is provided, the node will not perform any search. This parameter is crucial as it serves as the source material from which the node will attempt to find matches based on the provided regular expression pattern.

regex_pattern

The regex_pattern parameter is a string that defines the regular expression pattern you want to search for within the input_string. This pattern is not multiline, meaning it should be a single line of text. The default pattern is (?<=in\\s)(.*?)(?=,), which is designed to match text that appears between the word "in" and a comma. This parameter is essential as it dictates the criteria for what the node will consider a match. Understanding and crafting the right regular expression is key to effectively using this node to extract the desired text.

Regex Find Output Parameters:

found_match

The found_match output parameter is a string that contains the first match found in the input_string based on the regex_pattern. If a match is found, this parameter will return the matched text. If no match is found, it will return the message "No match found". This output is important as it provides the result of the node's search operation, allowing you to see whether the pattern you specified successfully matched any part of the input text.

Regex Find Usage Tips:

  • Ensure that your regex_pattern is correctly defined to match the specific text you are looking for. Regular expressions can be complex, so take the time to test and refine your pattern.
  • Use the input_string parameter to provide a comprehensive block of text for the node to search through. The more complete your input, the more likely you are to find the matches you need.
  • Familiarize yourself with regular expression syntax to make the most out of this node. There are many online resources and tools available to help you learn and test regular expressions.

Regex Find Common Errors and Solutions:

Regex error: <error_message>

  • Explanation: This error occurs when there is a syntax issue in the regex_pattern. Regular expressions have specific syntax rules, and any deviation from these rules can result in an error.
  • Solution: Review your regex_pattern for any syntax errors. Ensure that all special characters are properly escaped and that the pattern is correctly structured. Consider using an online regex tester to validate your pattern before using it in the node.

No match found

  • Explanation: This message indicates that the node did not find any text in the input_string that matches the regex_pattern.
  • Solution: Double-check your regex_pattern to ensure it accurately represents the text you are trying to match. Also, verify that the input_string contains the text you expect to find. Adjust the pattern or input as necessary to achieve the desired results.

Regex Find Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-CoCoTools
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 Playground, enabling artists to harness the latest AI tools to create incredible art.