ComfyUI Node

Simple Text Replace

Simple Text Replace

By KLL535·Created 9 months ago·Updated about 23 hours ago· 85
Simple Text Replace
    • text
    text
    rulesreplace text=new text remove text=

    LLM output is rarely clean enough to feed straight into the next node. The model says "Alright, here is a description:" when you asked for a tag list. It writes "a red car" when your downstream prompt needs "red_car". It pads answers with boilerplate that will pollute a filename or a metadata field. Simple Text Replace is a batch find-and-replace node: give it a set of rules and it scrubs your text in one pass.

    The mechanism is dead simple and that's its strength. You type rules as one line per replacement, in A=B format - text on the left gets replaced by text on the right. Leave the right side empty and the left side gets deleted outright. The node applies rules in order, so you can chain a cleanup sequence in a single node. The default rules field even shows the syntax: replace text=new text and a remove text= line with an empty right side, which is the delete use case.

    Inputs and outputs

    • text - the input string (multiline). Wire the Qwen node's text output here.
    • rules - the replacement rules, one per line, left=right. Blank right side = delete.
    • Output: text - the cleaned result.

    Concrete example:

    Alright, here is the answer:=
    a red car=red_car
    the image shows=
    

    That strips the "Alright…" preamble, normalizes the car phrase, and removes "the image shows" fluff. The rules field is itself multiline, so it doubles as documentation of what you're scrubbing.

    Install

    It ships in KLL535/ComfyUI_Simple_Qwen3-VL-gguf, the same pack as the main Qwen node:

    cd ComfyUI/custom_nodes
    git clone https://github.com/KLL535/ComfyUI_Simple_Qwen3-VL-gguf
    

    or ComfyUI Manager (search ComfyUI_Simple_Qwen3-VL-gguf), restart, F5.

    The honest take

    The one thing to know: this is plain string replacement, not regex. There's no wildcards, no case-insensitive matching, no pattern groups - "the image shows" won't catch "The Image Shows". For a quick scrubber that's fine; you just add more rules. If your cleanup needs real regex power, a general-purpose text tools pack is the better home for it. But for the 90% case - strip the preamble, normalize a few phrases, delete boilerplate - this is a zero-dependency text node that does exactly what it says, lives next to the Qwen nodes, and won't surprise you. Wire the LLM's text into it, and your downstream nodes finally get output that looks like it was written by a machine for machines.

    Category🌐 SimpleQwenVL

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    rulesSTRINGreplace text=new text remove text=

    Outputs (1)

    NameTypeDescription
    textSTRING