ComfyUI > Nodes > ComfyUI-gen2 > Gen2 StringReplace

ComfyUI Node: Gen2 StringReplace

Class Name

Gen2_StringReplace

Category
Gen2/Utils
Author
petmycat (Account age: 774days)
Extension
ComfyUI-gen2
Latest Updated
2026-03-06
Github Stars
0.02K

How to Install ComfyUI-gen2

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

Gen2 StringReplace Description

Gen2_StringReplace node replaces specific text in a string, ensuring case-sensitive accuracy.

Gen2 StringReplace:

The Gen2_StringReplace node is a utility designed to facilitate the process of replacing specific text within a string. This node is particularly useful for tasks that require precise text manipulation, such as editing or formatting text data. It operates by identifying all occurrences of a specified search string within the input text and replacing them with a designated replacement string. The replacement process is case-sensitive, meaning it will only replace text that exactly matches the specified search string, preserving the integrity of the text where case differences are significant. This node is an essential tool for AI artists and developers who need to automate text modifications efficiently, ensuring consistency and accuracy in text processing tasks.

Gen2 StringReplace Input Parameters:

input_string

The input_string parameter is the text that you want to process. It serves as the source material where the search and replace operations will be conducted. This parameter can handle multiline text, allowing for comprehensive text manipulation across multiple lines. The default value is an empty string, which means if no text is provided, the node will not perform any operations.

The search parameter specifies the exact string you want to find within the input_string. This is a case-sensitive parameter, meaning it will only match text that exactly corresponds to the specified string, including letter casing. The default value is an empty string, and if left empty, the node will not perform any replacements, effectively returning the input_string unchanged.

replace

The replace parameter is the string that will replace each occurrence of the search string found within the input_string. This allows you to customize the output by substituting specific text with new content. The default value is an empty string, which means if a match is found and no replacement text is specified, the matched text will be removed from the input_string.

Gen2 StringReplace Output Parameters:

output_string

The output_string is the result of the text replacement operation. It contains the modified version of the input_string where all instances of the search string have been replaced with the replace string. This output is crucial for verifying that the intended text modifications have been successfully applied, providing a clear and concise result of the operation.

Gen2 StringReplace Usage Tips:

  • Ensure that the search string is correctly specified with the exact case you intend to match, as the operation is case-sensitive.
  • Use the replace parameter to introduce new text or remove unwanted text by leaving it empty if you wish to delete the matched text.
  • Test the node with sample text to understand how case sensitivity affects the replacement process, especially when dealing with mixed-case text.

Gen2 StringReplace Common Errors and Solutions:

Empty Search String

  • Explanation: If the search parameter is left empty, the node will not perform any replacements and will return the input_string unchanged.
  • Solution: Ensure that the search parameter is populated with the exact string you wish to replace.

Case Sensitivity Mismatch

  • Explanation: The node did not replace text because the search string did not match the case of the text in the input_string.
  • Solution: Double-check the case of the search string to ensure it matches the text you intend to replace in the input_string.

Gen2 StringReplace Related Nodes

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

Gen2 StringReplace