Nodes/Vsaan212-workflow-utilities/Text Split (by separator)
ComfyUI Node

Text Split (by separator)

One prompt, eight outputs, and a remainder you don't lose

By vsaan212·Created 10 months ago·Updated 9 days ago· 1
Text Split (by separator)
    • text_1
    • text_2
    • text_3
    • text_4
    • text_5
    • text_6
    • text_7
    • text_8
    • remainder
    text
    separator|
    num_splits2
    trim_whitespacetrue
    remove_emptytrue
    tagged_formatfalse

    Text Split takes one multiline string and splits it into up to eight separate outputs plus a remainder socket, so nothing you feed it ever gets thrown away. It's the node someone points you to when you ask r/comfyui "how do I split text into different prompts?" - and yes, this is the exact pack that answer links.

    Why would you need that? The classic case is a single long prompt that has to drive several things at once - a multi-scene render where each scene's text goes to its own CLIP encoder, or a schedule where different chunks feed different samplers. Instead of copying the prompt into four separate text nodes and praying you keep them in sync, you split once and wire the outputs.

    How it works

    Feed text in (multiline, so wire a selector, Lazy Prompt Saver, or LazyPrompt output here), then pick how to split:

    • separator - a literal string (default |), or a regex wrapped in slashes like /\\|/ for fancier delimiters.
    • num_splits - how many primary outputs (text_1text_n) to fill before the remainder. Range 1–8.
    • trim_whitespace and remove_empty - tidy up chunks so indices stay meaningful.
    • tagged_format - the pack-specific mode. When ON, it splits at [Tag] lines instead of a separator, filling text_1, text_2, … with each section's body. This is what makes it work with the pack's subject/scenario files: auto-detected when the first line is [LoraHighA] (the v2 file format), so those files split correctly without you doing anything.

    The node always shows all nine outputs - text_1 through text_8, then remainder. Only the first num_splits plus remainder are meaningful; the rest are empty strings, so wiring them all is harmless. remainder is the "everything after the Nth split" bucket, which is the feature that separates this from a naive split: you can split off the first two chunks for dedicated encoders and still have the rest of the prompt intact downstream.

    Where it fits

    Two patterns from the pack's own docs are worth stealing:

    1. Selector → Text Split. Subject/scenario files (v2 format) split automatically - each [Tag] section becomes an output. Legacy #-separated files work with separator set to # when auto-detect doesn't apply. Force tagged_format ON for other [Tag] layouts that don't start with [LoraHighA].
    2. Parallel encoders. Wire text_1, text_2, … into separate CLIP Text Encode nodes for multi-part conditioning.

    It's also the natural consumer of LazyPrompt's PROMPT output if you want to drive several branches from one expanded prompt.

    Install

    Standard pack install: ComfyUI Manager → search vsaan212/Vsaan212-workflow-utilities, or clone into custom_nodes and restart. Menu: vsaan212/utilities. Genuinely zero dependencies - the code is pure Python standard library (its own requirements.txt says so), so there's nothing to break and no model downloads. That's the reason it gets recommended in help threads: it just works.

    One small note: the separator you set is also what rejoins the remainder chunks, so if you split on |, the remainder comes back as |-joined text. Plan your delimiter accordingly and keep trim_whitespace on.

    Categoryvsaan212/utilities

    Inputs (6)

    NameTypeDefaultDescription
    textSTRING
    separatorSTRING|
    num_splitsINT21–8
    trim_whitespaceBOOLEANtrue
    remove_emptyBOOLEANtrue
    tagged_formatBOOLEANfalseSplit at [Tag] lines. Auto-enabled when the first non-empty line is [LoraHighA] (v2 subject/scenario files). Otherwise this toggle applies.

    Outputs (9)

    NameTypeDescription
    text_1STRING
    text_2STRING
    text_3STRING
    text_4STRING
    text_5STRING
    text_6STRING
    text_7STRING
    text_8STRING
    remainderSTRING