ComfyUI Node

Split String

One cut, two outputs, and no regex drama

By rookiestar28·Created 9 months ago·Updated about 21 hours ago· 16
Split String
    • left
    • right
    text
    delimiter|

    Split String might be the most boring node in the ComfyUI Text Processor pack, and that's the point. It does exactly one thing - cut a text string once at the first literal delimiter - and hands you the two halves on separate left and right outputs. No modes, no regex, no settings to fiddle with. It exists for the moments your workflow has one packed string that needs to become two.

    Text strings are first-class wires in ComfyUI, so you eventually run into the "I have portrait, masterpiece|masterpiece, worst quality and want to feed only the first half to the CLIP encoder" problem. Or a dynamic-prompt setup where a Text Input node merged several sources into one line and something downstream wants them split back apart. Split String is the reverse of the pack's own Text Input combiner - glue them together with one node, peel them apart with this one. It's also the cheap move for parsing "label: value" style text and dropping the label before generation.

    How it works is a single line under the hood: text.split(delimiter, 1). Literal, case-sensitive, first match only. That split-once behavior is the whole personality of the node - if your text is a|b|c, you get a out of left and b|c out of right, because later delimiters stay untouched. No delimiter found? The whole original string comes out left, and right is an empty string (not None - worth knowing if you're wiring into something that toggles on empty vs. missing).

    The two inputs are all you'll ever set:

    • text - multiline box, whatever you want to cut.
    • delimiter - defaults to |, must be non-empty. Leave it blank and the node raises delimiter must not be empty rather than guessing.

    If your delimiter needs a pattern - split on any comma-or-pipe, extract between two markers, split on the second occurrence - this isn't your node. The same pack's Advanced Text Filter has 17 operation modes including regex-powered split/between/extract; reach for that instead. Split String is deliberately the no-regex, no-surprise option.

    Installing is standard. ComfyUI Manager → Custom Nodes Manager → search "ComfyUI Text Processor" → Install, or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/rookiestar28/ComfyUI_Text_Processor.git
    

    Then restart ComfyUI. The good news: no third-party runtime dependencies (its requirements.txt is empty) and no model downloads. It just needs Python 3.10+ and ComfyUI Core 0.22.3+.

    One honest caveat: this pack is young and barely has a community footprint yet - the author launched it on r/comfyui in late 2025 and it's been iterating fast since. For a node this trivial that's fine; the contract is simple enough that there's not much to break. Just remember the case-sensitivity (it won't match | if your text uses a full-width or ;) and that "first literal match" is a promise, not a limitation.

    When you just need one clean cut, this is the node you reach for - and then you never think about it again.

    CategoryComfyUI Text Processor

    Inputs (2)

    NameTypeDefaultDescription
    textSTRINGText to split at the first matching delimiter.
    delimiterSTRING|Literal non-empty delimiter used for the first split.

    Outputs (2)

    NameTypeDescription
    leftSTRINGText before the first delimiter, or the original text when no delimiter is found.
    rightSTRINGText after the first delimiter, or an empty string when no delimiter is found.