ComfyUI > Nodes > CRT-Nodes > Advanced String Replace (CRT)

ComfyUI Node: Advanced String Replace (CRT)

Class Name

AdvancedStringReplace

Category
CRT/Text
Author
CRT (Account age: 1707days)
Extension
CRT-Nodes
Latest Updated
2026-03-16
Github Stars
0.1K

How to Install CRT-Nodes

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

Advanced String Replace (CRT) Description

AdvancedStringReplace enables multi-word replacement, whitespace normalization, and exclusion management.

Advanced String Replace (CRT):

The AdvancedStringReplace node is a powerful tool designed to enhance text manipulation by allowing you to replace multiple words within a given string while also offering the ability to normalize whitespace and manage an exclusion list. This node is particularly beneficial for tasks that require precise text editing, such as preparing text data for further processing or cleaning up user-generated content. By providing a mechanism to exclude certain words from replacement, it ensures that important terms remain unchanged, thus preserving the integrity of the text. The node's ability to handle multiple replacements in a single operation makes it an efficient choice for complex text transformation tasks.

Advanced String Replace (CRT) Input Parameters:

source

The source parameter is the original string from which you want to replace words. It supports multiline input, allowing you to work with large blocks of text. This parameter is crucial as it serves as the base text that will undergo transformation. There is no explicit minimum or maximum value, but the default is an empty string.

to_replace

The to_replace parameter specifies the words you wish to find and replace within the source string. It also supports multiline input, enabling you to list multiple words or phrases that need to be substituted. This parameter directly impacts which parts of the text will be altered. The default value is an empty string.

replace_with

The replace_with parameter defines the word or phrase that will replace each occurrence of the words specified in to_replace. Unlike the other parameters, it does not support multiline input, as it is intended for a single replacement term. If left empty, the words found will be removed from the source string. The default value is an empty string.

exclude_words

The exclude_words parameter allows you to specify a list of words that should not be replaced, even if they appear in the to_replace list. This is useful for preserving certain terms that are critical to the meaning of the text. It supports multiline input and comes with a default list of common English stop words, which can be modified as needed.

Advanced String Replace (CRT) Output Parameters:

STRING

The output parameter is a single string that represents the transformed version of the source text. This string reflects all the replacements made according to the to_replace and replace_with parameters, while respecting the exclusions specified in exclude_words. The output is a clean, normalized text with unnecessary whitespace removed, making it ready for further use or analysis.

Advanced String Replace (CRT) Usage Tips:

  • To effectively use the AdvancedStringReplace node, ensure that your to_replace list is comprehensive and accurately reflects the words you intend to change. This will maximize the efficiency of the replacement process.
  • Utilize the exclude_words parameter to protect key terms from being altered, especially when working with text that contains important names or technical jargon.

Advanced String Replace (CRT) Common Errors and Solutions:

Empty Source or To Replace

  • Explanation: If either the source or to_replace parameter is empty, the node will not perform any replacements.
  • Solution: Ensure that both the source and to_replace parameters contain valid text before executing the node.

Unintended Deletions

  • Explanation: If the replace_with parameter is left empty, words found in the to_replace list will be removed from the source.
  • Solution: Double-check the replace_with parameter to ensure it contains the desired replacement text, or be aware that leaving it empty will result in deletions.

Advanced String Replace (CRT) Related Nodes

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