Nodes/Quality of Life Nodes for ComfyUI/Multi Find And Replace (Soze)
ComfyUI Node

Multi Find And Replace (Soze)

Ten find/replace passes in one node

By SozeInc·Created 2 years ago·Updated 5 days ago· 10
Multi Find And Replace (Soze)
    • STRING
    input_string
    find_text1
    replace_text1
    find_text2
    replace_text2
    find_text3
    replace_text3
    find_text4
    replace_text4
    find_text5
    replace_text5
    find_text6
    replace_text6
    find_text7
    replace_text7
    find_text8
    replace_text8
    find_text9
    replace_text9
    find_text10
    replace_text10

    This is the node you reach for instead of chaining ten separate "find and replace" nodes across your graph. One input_string goes in, up to ten find/replace pairs get applied, and one cleaned-up string comes out - useful for swapping placeholder tokens like {SUBJECT} for a real value pulled from elsewhere in your graph, standardizing inconsistent trigger-word casing, or stripping words you don't want reaching an API-based node further downstream.

    How it works

    Each pair - find_text1/replace_text1 through find_text10/replace_text10 - is a straightforward literal text substitution. There's no regex flag exposed anywhere in the node, so treat these as exact-text matches, not patterns. Leave a pair blank and it's a no-op; you don't need to fill all ten.

    One thing worth keeping in mind: the passes apply in the order you filled them. If pair 1's replacement text happens to contain something pair 2 is also searching for, pair 2 can catch that newly-introduced text too. It's rarely a problem in practice, but if a replacement isn't behaving the way you expect, check whether an earlier pair changed the string in a way that fed the next one something unintended.

    The inputs and output that matter

    • input_string - the text you're transforming.
    • find_text1..10 / replace_text1..10 - up to ten literal find/replace pairs, applied in order.

    The single output is STRING - the fully processed text, ready to wire into a CLIPTextEncode, a filename builder, or another string node further down the chain.

    A concrete example: you're pulling a prompt template out of a shared text file with {SUBJECT}, {STYLE}, and {LOCATION} placeholders in it - maybe fed in by Load Random Line From Text File. Set find_text1 to {SUBJECT} and replace_text1 to whatever a String Splitter handed you off a filename, find_text2 to {STYLE} and replace_text2 to a value from a dropdown, and so on. One node fills the whole template in a single pass instead of three chained replace nodes cluttering the graph.

    Installing it

    ComfyUI Manager: search ComfyUI_Soze. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/SozeInc/ComfyUI_Soze.git, pip install -r ComfyUI_Soze/requirements.txt, restart. Pure string handling - no models, no API keys, no dependencies beyond the pack itself.

    Common issues

    Case sensitivity: there's no toggle for it here, so assume exact-case matching - if your find text doesn't hit and you're sure the word is in there, check for a case mismatch first. And since each find_text/replace_text field is single-line, this node is built for token-style substitutions, not multi-line block replacement - for that, you'd want to restructure with this pack's Multiline Concatenate node instead and build the string up in pieces rather than search-and-replace across a big block.

    Categorystrings

    Inputs (21)

    NameTypeDefaultDescription
    input_stringSTRING
    find_text1optSTRING
    replace_text1optSTRING
    find_text2optSTRING
    replace_text2optSTRING
    find_text3optSTRING
    replace_text3optSTRING
    find_text4optSTRING
    replace_text4optSTRING
    find_text5optSTRING
    replace_text5optSTRING
    find_text6optSTRING
    replace_text6optSTRING
    find_text7optSTRING
    replace_text7optSTRING
    find_text8optSTRING
    replace_text8optSTRING
    find_text9optSTRING
    replace_text9optSTRING
    find_text10optSTRING
    replace_text10optSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING