ComfyUI Node

TextWildcards

TextWildcards

By lilly1987·Created 3 years ago·Updated 2 years ago· 57
TextWildcards
    • STRING
    • ASCII
    text
    seed0

    Wildcards are the oldest trick in the book for getting variety without writing fifty prompts, and TextWildcards is the raw engine of this pack given its own node. Feed it a prompt like a __hair__ girl in {a park|a cafe|the rain}, and it hands you back a fully expanded string: a redhead girl in the rain. No encoding, no model involved - it's a text processor, and it's the node every other wildcard node in this pack leans on under the hood.

    Why you'd reach for it specifically: it outputs plain text, so you can drive anything with it - not just a CLIP encode. Wire its STRING output into a text field on another custom node, build a character-reference library where each line of a .txt file is a camera setup or an outfit, and batch 30 generations that are all recognizably "the same" person doing different things. That's the exact workflow the community rediscovered as "prompt travel without training," and it's old A1111 wildcard syntax most people who started after 2024 never learned.

    How it works

    The pack reads every .txt file out of a wildcards folder that sits at your ComfyUI root - the same level as custom_nodes, where main.py lives - not inside the node folder. Each non-comment line of a file is one option. Then three layers of syntax get resolved, deepest first:

    • __name__ picks a random line from name.txt. __/subfolder/name__ targets a subfolder; __*__ and __?__ match any file (Python fnmatch rules, so [seq] works too).
    • {a|b|c} picks one random option. {2$$a|b|c} picks two. {1-2$$a|b|c} picks a random count between one and two. {2$$ and $$a|b|c} joins the picks with a custom separator instead of a comma.
    • Lines starting with # are skipped as comments.

    The two inputs are all you ever set: text (multiline) and seed. The seed matters more than it looks - the node calls random.seed(seed) before expanding, so the same seed plus the same text gives you the same draw. Change the seed to re-roll. Both outputs, STRING and ASCII, carry the same expanded text; the ASCII one is just a convenience wire type for nodes that prefer it.

    Install and gotchas

    Install is the standard clone-and-restart dance. ComfyUI Manager finds it if you search "Lilly"; otherwise:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lilly1987/ComfyUI_node_Lilly
    

    Then restart ComfyUI. There are no model downloads and no requirements.txt - the pack quietly pip-installs rich and chardet on first load, so give it a moment and don't panic at the wall of colored console logs.

    Two things will bite you. First, the big one: ComfyUI caches unchanged inputs, so if you re-queue the same prompt with the same seed, the wildcard does not re-roll - the community workaround since 2023 is to touch the prompt text or bump the seed. Second, this pack is genuinely unmaintained; the author's own README says so and points people to Impact Pack's wildcard node instead. For a fresh project, ImpactWildcard or WAS Suite's NSP encoder are the maintained equivalents. But if you've got a 2023-era workflow still using this, it runs.

    Categoryutils

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    seedINT00–18446744073709550000

    Outputs (2)

    NameTypeDescription
    STRINGSTRING
    ASCIIASCII