Nodes/ComfyUI-Addoor/🌻 Prompt Replace
ComfyUI Node

🌻 Prompt Replace

Find-and-replace for prompts, with built-in variation

By Eagle-CN·Created 2 years ago·Updated about a year ago· 75
🌻 Prompt Replace
    • Replaced_Text
    • new_seed
    Content
    Match
    Replace
    seed0
    Increment1

    Find-and-replace, but for prompts, with a dash of controlled randomness baked in. You leave a placeholder in your prompt, and this node swaps it for something else at runtime. Point it at a list of candidates and let the seed pick one, and you've got a lightweight wildcard system without installing a whole wildcards pack.

    Why you'd use it

    Two scenarios. The plain one: you've got a template prompt and one bit that changes - a photo of __SUBJECT__ in a forest - and you want to slot in different subjects programmatically instead of hand-editing the prompt each run. The more interesting one: batch variation. You want the same scene with different lighting, or the same character in different outfits, cycling automatically as you queue up generations. Rather than sitting there retyping, you let the node rotate through options.

    This is the same idea as wildcards, just node-native and keyed to a seed so it's reproducible - hit the same seed, get the same choice back.

    The inputs

    • Content - the source text (multiline). Your template prompt with whatever you want to replace in it.
    • Match - the text to find. A placeholder token like __SUBJECT__ works well because it won't collide with normal words.
    • Replace - what to swap in (multiline). This is where you put your options; the seed selects which one gets used.
    • seed - drives the selection, so variation is deterministic and repeatable.
    • Increment - how far the seed steps each run, for walking through options in order rather than jumping around randomly.

    Outputs are Replaced_Text (wire this into your CLIP Text Encode) and new_seed (feed it onward if you're chaining the progression across nodes or runs).

    Getting good results

    Use a distinctive Match token. If you try to replace a common word like red, you'll clobber it everywhere it appears, including inside other words. A guarded placeholder like __COLOR__ only matches where you mean it.

    And keep in mind where in the prompt your replacement lands - earlier keywords tend to pull more attention on CLIP-based models, so a subject swap near the front hits harder than one buried at the end. That's a prompt-structure thing, not a node setting, but it decides whether your variations actually read as different.

    Installing ComfyUI-Addoor

    ComfyUI Manager: Install Custom Nodes → search "ComfyUI-Addoor" → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Eagle-CN/ComfyUI-Addoor.git
    cd ComfyUI-Addoor
    pip install -r requirements.txt
    

    Restart; it's under 🌻 Addoor / Utilities. Pair it with an Incrementer or a CSV Reader if you want the replacement source to advance automatically across a batch.

    Category🌻 Addoor/Utilities

    Inputs (5)

    NameTypeDefaultDescription
    ContentSTRING
    MatchSTRING
    ReplaceSTRING
    seedINT00–18446744073709550000
    IncrementINT10–1000

    Outputs (2)

    NameTypeDescription
    Replaced_TextSTRING
    new_seedINT