Nodes/ComfyUI-Text-Utility/Process Wildcard
ComfyUI Node

Process Wildcard

Expand __wildcards__ and {a|b|c} in your prompt with a seed you control

By watarika·Created 2 years ago·Updated 10 months ago· 3
Process Wildcard
    • prompt
    wildcard_text
    seed0

    Wildcards are the trick that turns one prompt into a thousand: __haircolor__ pulls a random line out of haircolor.txt, {red|blue|green} dress picks one of the options inline. In ComfyUI that machinery lives in Impact Pack - ltdrdata's node pack, the same one that owns FaceDetailer. Process Wildcard is a thin, focused wrapper around Impact Pack's wildcard engine: you feed it text with wildcards plus a seed, and it hands back the fully expanded prompt.

    Why a dedicated node instead of Impact Pack's own wildcard nodes? Two reasons. First, the seed. Passing a seed makes expansion reproducible - same text plus same seed equals the same prompt every run. That's invaluable when you're debugging a prompt or trying to recreate the run that produced a great image. Second, it slots into a pure-text pipeline: any text-handling workflow can drop this in right before the CLIP encoder.

    How it works

    The source is almost embarrassingly short. The pack imports Impact Pack's impact.wildcards module and calls process(wildcard_text, seed). That's it - and that's the whole story. Since v1.5.3 the import happens lazily, only when a wildcard node actually runs, so the pack doesn't force Impact Pack on you if you never touch these nodes. But the moment one of them runs, Impact Pack has to be there.

    Because the engine is Impact Pack's, the rules are Impact Pack's rules: __name__ loads a wildcard file from the pack's wildcard directory, {a|b|c} is inline alternatives, and nested expansion (a wildcard whose value contains another wildcard) resolves through Impact Pack's own recursion.

    Inputs and outputs

    • wildcard_text (STRING, multiline) - your text with wildcard expressions. Multiple lines are fine.
    • seed (INT, 0 to 2^64-1) - the author's tooltip says it plainly: "Determines the random seed to be used for wildcard processing."
    • prompt (STRING) - the expanded result, ready for a CLIP Text Encode.

    So the typical hookup is: whatever produces your template → Process Wildcard → CLIP Text Encode (Positive). Give it seed 42 twice and the output is identical twice.

    Installing - read this part first

    ComfyUI-Impact-Pack must be installed before this node can run. The README leads with it. Install Impact Pack first (Manager → "ComfyUI-Impact-Pack", or git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack into custom_nodes), then this pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/watarika/ComfyUI-Text-Utility
    # restart ComfyUI, install Impact Pack first
    

    No pip requirements for this pack itself, no models to download. The wildcard .txt files live wherever Impact Pack expects them.

    Troubleshooting

    • A load-time or runtime error mentioning impact.wildcards means Impact Pack is missing or broken. That's the single most common failure, and it's not a bug in this node.
    • A mistyped __name__ doesn't error - that wildcard simply doesn't expand, and the literal text passes through. Check the file name against what's actually in your wildcard directory.
    • Seed 0 is a valid seed, not "no seed". If every run looks the same, it's because you're using a fixed seed - which is the point of the node, so flip it deliberately.

    The broader ecosystem does exactly this pattern: wildcard packs ship .txt files that other tools reference, so a working wildcard directory is shared infrastructure across Impact Pack, this node, and anything else that calls impact.wildcards.

    Categorytext

    Inputs (2)

    NameTypeDefaultDescription
    wildcard_textSTRING
    seedINT00–18446744073709550000Determines the random seed to be used for wildcard processing.

    Outputs (1)

    NameTypeDescription
    promptSTRING