ComfyUI > Nodes > ComfyUI-Addoor > 🌻 Prompt Replace

ComfyUI Node: 🌻 Prompt Replace

Class Name

AD_PromptReplace

Category
🌻 Addoor/Utilities
Author
ADDOOR (Account age: 2884days)
Extension
ComfyUI-Addoor
Latest Updated
2025-01-24
Github Stars
0.03K

How to Install ComfyUI-Addoor

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

🌻 Prompt Replace Description

Facilitates dynamic text replacement with seed-based randomization or controlled increment for creative content generation.

🌻 Prompt Replace:

The AD_PromptReplace node is a utility designed to facilitate dynamic text replacement within a given content string. Its primary function is to search for specific text patterns and replace them with alternative text, which can be selected either randomly or sequentially. This node is particularly useful for AI artists who need to generate varied textual prompts or modify existing text content in a flexible manner. By leveraging a seed-based randomization or a controlled increment approach, the node allows for creative experimentation and ensures that the text replacement process can be both predictable and varied, depending on the user's needs. This capability is essential for tasks that require the generation of diverse outputs from a single input template, enhancing the creative process by introducing variability and adaptability.

🌻 Prompt Replace Input Parameters:

Content

The Content parameter is a multiline string that represents the original text in which replacements will be made. It serves as the base text where the specified Match string will be searched and replaced. The default value is an empty string, and it can be customized to include any text content you wish to modify.

Match

The Match parameter is a string that specifies the exact text pattern you want to find within the Content. This is the text that will be replaced by the Replace parameter. The default value is an empty string, meaning no specific text is targeted for replacement unless specified.

Replace

The Replace parameter is a multiline string that provides the alternative text to substitute for the Match string in the Content. This parameter can contain multiple lines, allowing for varied replacements. The default value is an empty string, and it can be customized to include any replacement text you desire.

seed

The seed parameter is an integer that influences the random selection process when Increment is set to 0. It ensures that the randomization is consistent and repeatable, allowing for predictable outcomes when the same seed is used. The default value is 0, with a minimum of 0 and a maximum of 0xffffffffffffffff.

Increment

The Increment parameter is an integer that determines the method of selecting the replacement text. A value of 0 triggers random selection based on the seed, while any other value enables sequential selection, incrementing through the replacement options. The default value is 1, with a minimum of 0 and a maximum of 1000.

🌻 Prompt Replace Output Parameters:

Replaced_Text

The Replaced_Text output is a string that contains the modified version of the Content after the specified Match text has been replaced with the selected Replace text. This output reflects the changes made by the node and is essential for verifying the success of the replacement operation.

new_seed

The new_seed output is an integer that represents the seed used during the replacement process. This value is crucial for reproducing the same random selection results in future operations, ensuring consistency and repeatability in the text replacement process.

🌻 Prompt Replace Usage Tips:

  • To achieve consistent random replacements, use the same seed value across different runs. This will ensure that the random selection of replacement text remains the same each time.
  • If you want to cycle through replacement options in a specific order, set the Increment parameter to a non-zero value. This will allow you to control the sequence of replacements, which can be useful for generating a series of related outputs.

🌻 Prompt Replace Common Errors and Solutions:

Empty Content or Replace Lines

  • Explanation: If either the Content or Replace parameters are empty, the node may not perform any replacements as expected.
  • Solution: Ensure that both Content and Replace parameters contain valid text. If necessary, provide default text to avoid empty inputs.

Invalid Seed Value

  • Explanation: Using a seed value outside the allowed range can lead to unexpected behavior or errors.
  • Solution: Verify that the seed value is within the specified range (0 to 0xffffffffffffffff) and adjust it if necessary.

Increment Out of Range

  • Explanation: Setting the Increment parameter to a value outside the allowed range can disrupt the replacement sequence.
  • Solution: Ensure that the Increment value is between 0 and 1000 to maintain proper functionality. Adjust the value to fit within this range if needed.

🌻 Prompt Replace Related Nodes

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