Visit ComfyUI Online for ready-to-use ComfyUI environment
Versatile node for text pattern search using regular expressions, automating text manipulation for AI artists.
The D2 Regex Switcher is a versatile node designed to search for patterns within a given text using regular expressions and then concatenate and output the results. This node is particularly useful for AI artists who need to dynamically manipulate and format text based on specific patterns or keywords. By leveraging the power of regular expressions, the D2 Regex Switcher allows you to define complex search criteria and corresponding outputs, making it an essential tool for text processing tasks where precision and flexibility are required. Its primary goal is to streamline the process of text manipulation by automating the matching and formatting of text based on user-defined rules, thus enhancing productivity and creativity in text-based projects.
This parameter represents the text that you want to search through using regular expressions. It is a required input and can be a multiline string, allowing you to work with large blocks of text. The default value is an empty string, and it is crucial for determining the context in which the regular expressions will be applied.
This parameter is a multiline string that contains pairs of regular expressions and their corresponding output text, separated by --
. It defines the patterns to search for and the text to output when a match is found. The default value is "pony\n--\nscore_9,\n--\n--\nhighres, high quality,"
, which serves as an example of how to structure the input. This parameter is essential for specifying the rules that the node will use to process the input text.
This parameter allows you to specify a delimiter to be added before the matched text in the output. The options are "Comma", "Line break", and "None", with no default value specified. This setting helps in formatting the output text by adding a desired separator before the matched content.
Similar to pre_delim
, this parameter specifies a delimiter to be added after the matched text in the output. The options are the same: "Comma", "Line break", and "None". This parameter is useful for ensuring that the output text is formatted according to your needs by appending a separator after the matched content.
This parameter determines whether the original text should be displayed in the output. It accepts "True" or "False" as options, with "True" as the default value. This setting is helpful for debugging or for when you need to see the original text alongside the processed output.
This optional parameter is a multiline string used for input verification. It allows you to provide additional text for checking purposes, ensuring that the input text meets certain criteria before processing. This can be useful for validating the input text format or content.
This optional parameter allows you to specify a string to be added at the beginning of the output text. It is a multiline string with a default value of an empty string. This parameter is useful for adding a consistent starting text to all outputs, which can be helpful for labeling or categorizing the results.
This optional parameter allows you to specify a string to be added at the end of the output text. Like prefix
, it is a multiline string with a default value of an empty string. This parameter is useful for appending a consistent ending text to all outputs, which can be helpful for labeling or categorizing the results.
This output parameter is a string that contains the final concatenated text after applying the regular expressions and formatting rules. It includes the matched text, along with any specified prefixes, suffixes, and delimiters. This output is the primary result of the node's processing and is used for further text manipulation or display.
This output parameter returns the prefix string that was added to the beginning of the combined_text
. It is useful for verifying that the correct prefix was applied during the text processing.
This output parameter returns the suffix string that was added to the end of the combined_text
. It is useful for verifying that the correct suffix was applied during the text processing.
This output parameter is an integer that indicates the index of the matched regular expression pattern within the regex_and_output
list. It is useful for understanding which pattern was matched and can be used for debugging or further processing logic.
regex_and_output
parameter is well-structured with clear and precise regular expressions. This will help in accurately matching the desired patterns in your text.prefix
and suffix
parameters to add context or labels to your output, making it easier to categorize or identify the results in larger projects.pre_delim
and suf_delim
parameters to achieve the desired formatting for your output text, especially when preparing text for presentation or further processing.regex_and_output
parameter.regex_and_output
parameter for any incorrect or unsupported patterns. Ensure that the input text is in the expected format and that the regular expressions are designed to handle the input correctly.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.