ComfyUI > Nodes > ComfyUI > Regex Match

ComfyUI Node: Regex Match

Class Name

RegexMatch

Category
utils/string
Author
ComfyAnonymous (Account age: 872days)
Extension
ComfyUI
Latest Updated
2025-05-13
Github Stars
76.71K

How to Install ComfyUI

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

Powerful utility for pattern recognition and validation in text data using regular expressions, enabling complex string matching operations with ease.

Regex Match:

The RegexMatch node is a powerful utility designed to help you determine if a specific pattern exists within a given string using regular expressions. This node is particularly useful for tasks that require pattern recognition or validation within text data. By leveraging the capabilities of regular expressions, RegexMatch allows you to perform complex string matching operations with ease. Whether you're looking to validate input formats, search for specific text patterns, or filter data based on certain criteria, this node provides a flexible and efficient solution. Its ability to handle case sensitivity, multiline text, and special character matching makes it a versatile tool in any text processing workflow.

Regex Match Input Parameters:

string

The string parameter is the text input where the regular expression will be applied. It can be a single line or multiline text, depending on your needs. This parameter is crucial as it serves as the source data for pattern matching. There are no specific minimum or maximum values, but the text should be provided in a format that the node can process.

regex_pattern

The regex_pattern parameter is the regular expression pattern you want to search for within the provided string. This pattern defines the criteria for matching text and can include various regular expression syntax elements to specify complex search conditions. Like the string parameter, it can also be multiline. There are no specific minimum or maximum values, but the pattern should be a valid regular expression.

case_insensitive

The case_insensitive parameter is a boolean option that determines whether the regular expression matching should ignore case differences. If set to True, the matching process will not differentiate between uppercase and lowercase letters, making it useful for case-insensitive searches. The default value is True.

multiline

The multiline parameter is a boolean option that affects how the regular expression treats the input string. When set to True, the ^ and $ anchors will match the start and end of each line, respectively, rather than the start and end of the entire string. This is particularly useful when working with multiline text. The default value is False.

dotall

The dotall parameter is a boolean option that changes the behavior of the dot (.) in the regular expression pattern. When set to True, the dot will match all characters, including newline characters, which is useful for matching patterns across multiple lines. The default value is False.

Regex Match Output Parameters:

matches

The matches output parameter is a boolean value that indicates whether the regular expression pattern was found in the input string. If the pattern is found, the output will be True; otherwise, it will be False. This output is essential for determining the presence or absence of the specified pattern in the text.

Regex Match Usage Tips:

  • Use the case_insensitive parameter to perform searches that are not affected by letter casing, which can be particularly useful when dealing with user input that may vary in capitalization.
  • Enable the multiline and dotall options when working with text that spans multiple lines, allowing for more flexible pattern matching across line breaks.
  • Test your regular expression patterns using online regex testers to ensure they are correctly formatted and will produce the desired results when used in the node.

Regex Match Common Errors and Solutions:

Invalid regular expression

  • Explanation: This error occurs when the regex_pattern provided is not a valid regular expression.
  • Solution: Double-check the syntax of your regular expression pattern to ensure it adheres to the correct format and does not contain any errors.

No match found

  • Explanation: This is not an error per se, but it indicates that the pattern was not found in the input string.
  • Solution: Verify that the regex_pattern accurately represents the text you are trying to match and consider adjusting the case_insensitive, multiline, or dotall parameters if necessary.

Regex Match Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI
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.