Nodes/ComfyUI Level Pixel/Text Choice Parser [LP]
ComfyUI Node

Text Choice Parser [LP]

The old A1111 {this|that} wildcard trick, as a node

By LevelPixel·Created 2 years ago·Updated 5 months ago· 31
Text Choice Parser [LP]
    • text
    text
    variables
    seed0

    If you've ever written a prompt like a woman with {brown|blonde|black} hair in Automatic1111 and watched it pick a different option every batch, that's the exact trick this node brings into ComfyUI. It's old syntax - Stable Diffusion WebUI wildcard notation from years before ComfyUI existed - and a lot of people who arrived after 2024 have never seen it, which is a shame, because it's a genuinely fast way to get prompt variety without writing more prompts.

    What it does and why it's worth having

    Wrap alternatives in curly braces separated by pipes anywhere inside your text, batch the run, and each execution resolves the brackets to a different combination. It's been used in the wild to build character reference libraries - the same person rendered across different cameras, lighting, and moods, batched dozens of times with zero training involved, just by stacking multiple bracket groups in one prompt. That's the use case this node is built for: instead of hand-writing N near-identical prompt variants, you write one prompt with the variation points marked, and let the node do the picking.

    The seed input is what makes this reproducible rather than purely random - the same seed against the same text should resolve to the same choices, mirroring how a sampler's seed pins down an otherwise-random process. The variables field is a separate, optional input for defining reusable values that text can reference, rather than writing every alternative inline every time - useful if the same choice set (a cast of character names, a set of camera angles) gets reused across several prompts in one workflow. Neither the README nor the schema documents the exact reference syntax for variables, so the fastest way to learn it is to open the node and read any default/example text it ships with, or test a simple one-variable case first.

    Inputs and outputs that matter

    • text (required, multiline) - your prompt, with {option one|option two|option three} groups anywhere you want variation.
    • variables (optional, multiline) - reusable named values text can pull from.
    • seed (optional, integer, default 0) - pins down which alternatives get picked; same seed, same text in, same result out.

    Output: text - the resolved string, with all bracket groups replaced by whichever alternatives the seed selected. It's also flagged as an output node, meaning it always runs even without a downstream connection.

    Installing it

    Through ComfyUI Manager, search "ComfyUI Level Pixel" or "ComfyUI-LevelPixel." Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git
    

    Restart ComfyUI. Pure text processing, no models or extra dependencies.

    Common issues & troubleshooting

    Brackets aren't resolving - the literal {a|b|c} shows up in your output. Check for typos in the bracket syntax itself first (mismatched braces, a missing pipe), since a parser like this typically needs exact {...|...} formatting to recognize a choice group at all.

    Every batch picks the same option and you wanted variety. That's the seed doing exactly what it's supposed to - a fixed seed pins the choice down for reproducibility, which is great once you've found a combination you like and want to lock in, but the opposite of what you want while fishing for variety. Randomize the seed (control_after_generate-style, or just change it between runs) if you want a different combination each batch.

    Wiring text into a CLIP Text Encode. Since the output is a plain STRING, it should connect directly into any text-consuming node in this pack or elsewhere in ComfyUI - treat it the same as any other text-source node's output.

    CategoryLevelPixel/Text

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    variablesoptSTRING
    seedoptINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    textSTRING