Nodes/ComfyUI Easy Use/XY Inputs: PromptSR //EasyUse
ComfyUI Node Runs on cloud

XY Inputs: PromptSR //EasyUse

PromptSR — swap one word or phrase across a whole grid

By yolain·Created 3 years ago·Updated 12 days ago· 2,647
XY Inputs: PromptSR //EasyUse
    • X or Y
    target_prompt
    search_txt
    replace_all_textfalse
    replace_count3
    replace_1
    replace_2
    replace_3
    replace_4
    replace_5
    replace_6
    replace_7
    replace_8
    replace_9
    replace_10
    replace_11
    replace_12
    replace_13
    replace_14
    replace_15
    replace_16
    replace_17
    replace_18
    replace_19
    replace_20
    replace_21
    replace_22
    replace_23
    replace_24
    replace_25
    replace_26
    replace_27
    replace_28
    replace_29

    "PromptSR" is search-and-replace for your prompt, run across a grid. Give it a word or phrase to find and a list of replacements, and it hands easy XY Plot Advanced one column (or row) per variant - your original prompt untouched, then the same prompt with that phrase swapped for each replacement in turn. It's the node for "what does this prompt look like if I swap 'red car' for 'blue car', 'green car', 'rusted car'" without retyping the whole thing five times.

    Why you'd reach for it

    Any time you want to isolate the effect of one word or phrase while holding everything else in the prompt constant - testing color words, art-style tags, subject descriptors, camera angles, whatever single term you suspect is doing the heavy lifting. Because this operates on raw text before encoding, it's a cleaner comparison than swapping whole prompts by hand: the rest of the sentence, its structure, and its token order stay identical, so any difference in the output is more plausibly attributable to the phrase you actually changed.

    How it works

    Pick whether you're editing the positive or negative prompt, type the exact text to search for in search_txt, and fill in your replacement candidates. The node always includes your original prompt unchanged as the first entry - that's your baseline - then appends one more entry per replacement you've filled in, each with search_txt swapped for that replacement. replace_count controls how many of the numbered replacement fields actually get used, so bump it up if you add more than the default three. The result gets tagged as either "Positive Prompt S/R" or "Negative Prompt S/R" and passed to easy XY Plot Advanced, which runs one generation per entry - original plus however many swaps - with everything else in your workflow held fixed.

    The inputs and outputs that matter

    • target_prompt - positive or negative: which prompt the search-and-replace applies to.
    • search_txt - the exact text to find. Needs to match the wording in your actual prompt for the swap to do anything.
    • replace_all_text (default off) - off replaces just the first match of search_txt; on replaces every occurrence in the prompt.
    • replace_count (default 3) - how many of the replace_1replace_29 fields get included as grid entries. Raise it if you've filled in more than three replacements.
    • replace_1 through replace_29 - your replacement candidates, one per field. Only the first replace_count of these are used.

    Output is a single X or Y, wired into whichever axis of easy XY Plot Advanced you want the search-and-replace sweep on.

    How to install it

    ComfyUI Manager: search ComfyUI Easy Use, install, restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yolain/ComfyUI-Easy-Use
    

    Windows: double-click install.bat. Linux/Mac: pip install -r requirements.txt. Restart ComfyUI. No models, no extra dependencies.

    Common issues & troubleshooting

    The single most common miss: search_txt has to match the actual text in your prompt exactly, including case and spacing. If you type "Red Car" into search_txt but your prompt says "red car", nothing gets replaced and every entry in the grid - aside from the unavoidable baseline - will look identical to the original. Copy the phrase straight out of your prompt rather than retyping it from memory.

    Second, replace_count is easy to forget about: if you fill in replace_4 and replace_5 but leave replace_count at the default 3, those extra fields are silently ignored and won't show up in your grid. Bump the count to match however many replacement fields you've actually filled in.

    Third, watch replace_all_text if your search phrase is a common word or a substring of something else in the prompt - with it on, every occurrence gets swapped, which is what you want for a word repeated deliberately but can produce unintended changes if the phrase happens to appear somewhere you weren't thinking about. With it off, only the first occurrence changes, which is usually the safer default for a one-word or one-phrase test.

    Finally, as with any grid tool here: this feeds easy XY Plot Advanced, which also needs a pipe from your loader wired in - this node's output alone doesn't have a workflow to run against.

    CategoryEasyUse/XY Inputs

    Inputs (33)

    NameTypeDefaultDescription
    target_promptCOMBO2 options: positive, negative
    search_txtSTRING
    replace_all_textBOOLEANfalse
    replace_countINT31–29
    replace_1STRING
    replace_2STRING
    replace_3STRING
    replace_4STRING
    replace_5STRING
    replace_6STRING
    replace_7STRING
    replace_8STRING
    replace_9STRING
    replace_10STRING
    replace_11STRING
    replace_12STRING
    replace_13STRING
    replace_14STRING
    replace_15STRING
    replace_16STRING
    replace_17STRING
    replace_18STRING
    replace_19STRING
    replace_20STRING
    replace_21STRING
    replace_22STRING
    replace_23STRING
    replace_24STRING
    replace_25STRING
    replace_26STRING
    replace_27STRING
    replace_28STRING
    replace_29STRING

    Outputs (1)

    NameTypeDescription
    X or YX_Y