Nodes/Eden.art nodesuite/String Replace
ComfyUI Node Runs on cloud

String Replace

Find-and-replace for text wires, no regex required

By edenartlab·Created 3 years ago·Updated 10 days ago· 120
String Replace
    • STRING
    ◄input_string►
    ◄target_text►
    ◄replace_with►

    Eden_StringReplace is the plain-language cousin of the pack's Eden_Regex_Replace. Where the regex node asks you to think in patterns and capture groups, this one does a literal find-and-replace: take input_string, swap every occurrence of target_text for replace_with, hand you back the result. No pattern language, no metacharacters, no surprises.

    Its official description: "Replaces all occurrences of target text with replacement text in the input string." It's part of eden_comfy_pipelines, Eden.art's 70+ node suite.

    The three inputs

    • input_string - the text to edit (multiline, so whole prompts work).
    • target_text - the exact substring to find. Exact matters: "cat" matches "cat" inside "concatenate" too, because this is a literal substring match, not a whole-word match. If you need word boundaries or wildcards, that's what the regex node is for.
    • replace_with - what replaces it. Leave empty to delete.

    One output, STRING, the edited text.

    The useful details

    Because it's a literal str.replace, the behavior is dead simple and that's the appeal: nothing is escaped, nothing is interpreted. Looking for "a.b"? It matches the literal characters a.b, not "an a, any char, a b" like it would in regex. That predictability makes it the right tool for most real cleanup jobs:

    • Swapping a token in a prompt template: replace {{subject}} with your actual subject.
    • Normalizing a filename across a batch: " - " → "_".
    • Scrubbing a string before you hash it or log it: remove quotes, drop line breaks.

    The one gotcha is that it replaces every occurrence - there's no "first match only" control. For that, or for anything with patterns, walk over to Eden_Regex_Replace, which lives in the same pack and gives you max_n_replacements and case-sensitivity toggles. The two nodes are meant to be a matched set: literal when you don't need to think, regex when you do.

    Why it's in the Eden pack

    Eden_StringReplace is one of those unglamorous utility nodes that makes the pack's bigger string machinery work. It plugs directly into the pattern of driving everything from a single editable string - replace a token upstream, and every downstream node (prompts, filenames, GPT calls) updates. It's also a handy inline text scrubber when you're building filenames out of prompts and need to strip characters your filesystem hates.

    Installing it

    Standard pack install - ComfyUI Manager (search "eden"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/edenartlab/eden_comfy_pipelines.git
    cd eden_comfy_pipelines
    pip install -r requirements.txt
    

    Restart ComfyUI. No models, no keys, no downloads - it's a string function wearing a node costume, and it does its one job cleanly.

    CategoryEden 🌱/Text

    Inputs (3)

    NameTypeDefaultDescription
    input_stringSTRINGText to search in.
    target_textSTRINGLiteral text to find.
    replace_withSTRINGText to insert instead.

    Outputs (1)

    NameTypeDescription
    STRINGSTRING—