Nodes/ComfyUI Deploy/String Combine (ComfyUI Deploy)
ComfyUI Node

String Combine (ComfyUI Deploy)

String Combine With a Hidden Regex Superpower

By BennyKok·Created 3 years ago·Updated 10 months ago· 1,529
String Combine (ComfyUI Deploy)
    • STRING
    ◄action▾►
    ◄tidy_tags▾►
    ◄text_a—►
    ◄text_b—►
    ◄text_c—►

    The one node in this pack that isn't an API input. ComfyUIDeployStringCombine is a string utility that lives in the ComfyUI Deploy category because deployed workflows need to assemble and clean text on the fly - combining a caller's prompt with a style suffix, or scrubbing a raw prompt before it hits the CLIP encoder. It looks like yet another string concat node. It is not. There's a regex engine hiding in the replace mode.

    How it works

    Two actions. append joins whatever of text_a, text_b, text_c are non-empty. replace does the interesting work: text_b is the needle, text_c the replacement, applied to text_a. But if you wrap text_b in forward slashes - like /foo.*bar/ - it's treated as a regex and text_c is substituted over every match. That's the difference between this and every basic string-join node: you can do pattern-based prompt surgery server-side, no Python node required.

    Then tidy_tags ("yes"/"no") cleans the result: collapses double spaces, strips stray " ," sequences, flattens repeated commas, and trims. On append mode with tidy on, the parts join with ", " - the classic tag-format separator. With tidy off they just concatenate with nothing between them, which is how you'd build a raw prompt without commas.

    Why it's an output node

    The brief flags this as an output node (is_output_node: true), and that's deliberate: the node pushes its result to the UI as well as returning it as a STRING. So it can act as a display node showing the combined text in your graph - handy when the ComfyUI Deploy dashboard should show a computed string instead of just consuming it. Wire the STRING output into a CLIP Text Encode and it behaves like any normal string node.

    The inputs that matter

    • action - append or replace. This decides everything.
    • tidy_tags - yes/no, whether to run the comma/space cleanup.
    • text_a / text_b / text_c - the three string inputs. In replace, text_b is the needle (or /regex/), text_c the replacement.

    Installing

    Same pack as the rest of the ComfyUI Deploy set - Manager → "ComfyUI Deploy", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/BennyKok/comfyui-deploy
    

    Restart ComfyUI. No models, no heavy deps beyond the pack's usual light requirements.txt.

    Gotchas

    The replace regex path is the one to be careful with: if text_b starts with / you've entered regex territory, so a literal string that begins with a slash will misbehave. And remember append with tidy off produces zero separators - if you expected "a, b" and got "ab", that's the toggle, not a bug. For simple concatenation with commas, tidy on is what you want.

    Category🔗ComfyDeploy

    Inputs (5)

    NameTypeDefaultDescription
    actionCOMBO2 options: append, replace
    tidy_tagsCOMBO2 options: yes, no
    text_aoptSTRING—
    text_boptSTRING—
    text_coptSTRING—

    Outputs (1)

    NameTypeDescription
    STRINGSTRING—