Nodes/Arctenoxs-Essentials_ComfyUI/Wildcard Processor (Arctenox's Essentials)
ComfyUI Node

Wildcard Processor (Arctenox's Essentials)

Resolve your wildcards before they ever hit the CLIP encoder

By Arctenox·Created 8 months ago·Updated 2 months ago· 1
Wildcard Processor (Arctenox's Essentials)
    • resolved_prompt
    • original_prompt
    • seed_used
    prompt
    seed-1

    The Wildcard Processor is the workhorse of the wildcard family: you hand it a prompt containing __file__ tokens and {a|b|c} inline groups, it resolves every one of them, and it hands you back a plain string with no wildcard syntax left in it. If you've seen the old A1111 wildcard trick - {brown|blonde|black} hair choosing a different option every run - this is that, done properly inside ComfyUI.

    Two syntaxes, both handled:

    • __filename__ picks a random line from wildcards/filename.txt (comments starting with # are skipped).
    • {option_a|option_b|option_c} picks one option, and groups can be nested - inner groups resolve first.

    Inputs are just prompt (multiline) and seed (-1 = random each execution, any fixed number = reproducible). Outputs:

    • resolved_prompt - the final string, wildcards gone.
    • original_prompt - the raw input, passed through unchanged. This is deliberate: it lets you wire one node's string into the encoder while keeping the un-resolved original for logging or a metadata node.
    • seed_used - the actual seed that drove the resolution, so you can replay a specific output.

    Mechanically it's a random.Random(seed)-driven regex pass, so the same seed always gives the same picks. That reproducibility is the feature that separates "wildcards" from "surprise me and forget it": set a fixed seed and you can debug a weird prompt, or deliberately step through variations.

    Where this node sits in a workflow matters more than it looks. Most people who want wildcards just use a CLIP encode node with built-in wildcard support (this pack has one - CLIP Text Encode [Positive + Wildcards]) and never need the Processor. But there are two cases where resolving before the encoder wins:

    1. You're building the prompt out of parts. Wildcard Stack, String Concatenate, or a string switch - resolve each segment first, then join them, so wildcards in one segment don't accidentally span the join.
    2. You want to see what actually ran. A string preview node or a text log fed from resolved_prompt shows you the concrete prompt instead of the template, which is gold when a generation comes out weird and you need to know whether __pose__ picked "crouching" or "falling".

    If a __token__ has no matching file, the node leaves the token untouched and prints a quiet console note rather than crashing - a gentle reminder to check your filename, and a reason to keep your wildcard filenames unambiguous.

    Install. Part of Arctenox's Essentials - ComfyUI Manager → search "Arctenox's Essentials", or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Arctenox/Arctenoxs-Essentials_ComfyUI
    

    Restart ComfyUI. Wildcards are read from ComfyUI/custom_nodes/Arctenoxs-Essentials_ComfyUI/wildcards/ or ComfyUI/wildcards/ - drop your .txt files in either. Dependencies are just torch, numpy, and optional psutil. The pack is labeled deprecated by its author while a remastered successor is built, but the wildcard files and syntax are portable, so nothing you learn here is wasted.

    CategoryArctenox Essentials/Wildcards

    Inputs (2)

    NameTypeDefaultDescription
    promptSTRINGPrompt with __wildcards__ and {inline|options}
    seedINT-1-1–2147483647-1 = random each execution

    Outputs (3)

    NameTypeDescription
    resolved_promptSTRING
    original_promptSTRING
    seed_usedINT