Nodes/honda-nodes/πŸ”€ Text Split
ComfyUI Node

πŸ”€ Text Split

Turn one comma-separated string into a batch of prompts

By AvarayΒ·Created 14 days agoΒ·Updated 12 days agoΒ· 0
πŸ”€ Text Split
    • Output
    β—„textβ€”β–Ί
    β—„split_byComma (,)β–Ί
    β—„custom_splitterβ–Ί
    β—„output_typeArray / Listβ–Ί
    β—„skip_emptytrueβ–Ί
    β—„trim_whitespacesfalseβ–Ί

    Most of the nodes in ComfyUI that anyone writes about touch pixels. Samplers, ControlNet preprocessors, upscalers. Underneath them sits a much bigger population of nodes that touch nothing at all - values, switches, string surgery - and that layer is invisible in every tutorial. πŸ”€ Text Split lives there, in the Avaray/honda-nodes pack, and it does one unglamorous job: take the string you have and give you back N strings.

    What you'd actually reach for it for

    The scenario is always the same. Somewhere upstream you have one text value: a comma-separated tag line pulled out of a CSV, a whole prompt sitting in a .txt file read by a file node, a \n-separated list of scene descriptions, the output of an LLM node. Somewhere downstream you need each of those pieces separately - one per run, one per prompt box, one per filename.

    You wire the string in, pick a delimiter, and choose whether the output comes back as a list (so the graph fans out and runs once per part) or as a single re-joined string. That second option is the one beginners miss: sometimes you don't want to split for execution, you want to split so you can reformat - turn tag1, tag2, tag3 into newline-separated text for a different consumer.

    How it works

    Mechanically it's Python doing Python things, and knowing that explains every quirk. With Split By set to Comma, New Line, Space or Custom String, it does a literal str.split() on that separator - no cleverness, no escaping. Set it to Custom Regex and it switches to re.split() instead, which is where it becomes genuinely useful: split a prompt on any run of whitespace, pull apart key: value pairs, or break a string on multiple possible delimiters at once.

    The inputs you set

    Text - the input string. Worth knowing before you start complaining: this socket is forced to be an input by the pack's own schema, so there's no text box to type into. You can't just paste your tag line into the node; you have to connect something that produces text (a Primitive string node, a file reader, a concatenate node). That trips people up on first contact.

    Split By - Comma, New Line, Space, Custom String, or Custom Regex. Custom Splitter is only read when you pick one of the last two; it's ignored otherwise, which is a common "why isn't this working" moment. Leave it blank and the node politely hands back your whole string unsplit.

    Output Type - this is the real decision:

    • Array / List - returns an actual Python list down the wire. ComfyUI lets lists traverse connections, so a downstream node fed by this runs once per element. That's how one string of ten prompts becomes ten renders.
    • Comma-Separated (CSV) / New Line Each - re-joins the parts with , or \n. Use these when the split was only step one of a reformat.
    • JSON Array - a quoted, bracketed JSON string, for feeding the pack's JSON nodes or an API call.

    Everything - list, CSV, newline-joined text, JSON - leaves through the one Output socket, typed STRING.

    Skip Empty Parts is on by default, which saves you from ,, typos producing blank prompts. Trim Whitespaces is off by default - and you will want to turn it on. Splitting red hair, blue eyes on a comma leaves " blue eyes" with a leading space, and that space travels into your prompt where it does nothing useful and confuses your own eyeballs when debugging.

    Install

    ComfyUI Manager, search Honda Nodes, install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone --depth 1 https://github.com/Avaray/honda-nodes.git
    cd honda-nodes
    python install.py
    

    That install.py downloads two binaries (jq and the author's ime metadata tool) into the pack's bin/ folder. The text nodes don't use either of them - but run it anyway, because the pack's metadata and image nodes will fail without it and you'll want those later.

    This pack is written against ComfyUI's newer V3 schema (comfy_api.latest) and declares a minimum ComfyUI version of 0.38.0. On an old install the nodes simply won't appear in the menu, and no amount of restarting fixes it. Update ComfyUI.

    Where it goes wrong

    Nothing runs. Neither Text Split nor most of its neighbours are output nodes. ComfyUI only executes what an output node depends on, so if you split a string and connect Output to nothing, the node is skipped and the console stays quiet. Hang a πŸ› οΈ Print to Console or a text preview off the output while you're building.

    The list ran the whole graph five times. That's what Array / List does. If you wanted one prompt made of five pieces, you wanted a concatenate node - the pack has one - or the CSV output here.

    Invalid regex, no error. Typos in Custom Splitter under regex mode are caught, logged to the server console, and the node falls back to passing the whole string through. The graph keeps running and your output is wrong. Watch the console when a regex split produces one giant part.

    Category⚑️ Honda Nodes/πŸ”€ Text

    Inputs (6)

    NameTypeDefaultDescription
    textSTRINGThe original text to split (must be connected from another node).
    split_byCOMBOComma (,)What to use to split the text.
    custom_splitterSTRINGUsed only if 'Split By' is set to Custom String or Custom Regex.
    output_typeCOMBOArray / ListFormat of the final output. Array is standard for batching. JSON is useful for API integrations.
    skip_emptyBOOLEANtrueIf enabled, ignores any resulting text parts that are completely empty.
    trim_whitespacesBOOLEANfalseIf enabled, removes extra spaces from the beginning and end of each split part.

    Outputs (1)

    NameTypeDescription
    OutputSTRINGβ€”