Nodes/PPWildCard/Wildcard termination
ComfyUI Node

Wildcard termination

The prompt cleanup node that catches your dangling wildcards

By kohs100·Created about a year ago·Updated 2 months ago· 0
Wildcard termination
    • output
    input

    Every wildcard workflow eventually has this moment: a __token__ that never got resolved, sitting in your prompt as raw text and doing who knows what to your CLIP encoder. PPWCTerminate is the cleanup crew for exactly that. Its whole job - stated in the node description - is to remove dangling special tokens and normalize the prompt. It's the least glamorous node in the pack and the one you'll be glad exists.

    The mechanism is barely longer than this sentence. The incoming prompt is split on commas, any token that starts with __ is thrown out, and the survivors are rejoined with ", ". One input (input, a string wired in from your prompt path), one output (output, the cleaned string). Because wildcard syntax in this ecosystem is the doubled-underscore form, a leftover __hair_color__ - say a conditional branch didn't run, or a wildcard list had a blank line - gets stripped wholesale instead of leaking literal brackets into the encoder. The normalization part also quietly fixes the other classic mess: stray double spaces and empty entries from comma tokenization, which is how the prompt reads before you've even started.

    Where it belongs in a PPWildCard graph is at the very end of the string pipeline, right before your CLIP Text Encode node:

    PPWCReplace ──> PPWCTerminate ──> CLIP Text Encode (positive)
    

    If you're also gating LoRAs with PPWCLoraDetector, tap the prompt for the detector before termination - that node wants to see the tokens while they still exist. Terminate is what keeps junk out of the encoder, not out of your logic.

    Two honest limits, both from reading the source rather than the marketing. It only checks the start of a token, so a token like something__ (leading marker missing, trailing one intact) sails through - this is a dangling-__wildcard__ sweeper, not a general bracket validator. And it has no knowledge of which tokens are valid, so if you ever legitimately want __ in a prompt, you can't. Neither is a real problem in practice; wildcards begin with __, and you're using this node precisely because the leftovers are garbage.

    Install is the pack's usual one-liner, and this pack has no dependencies to babysit:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kohs100/comfyui-ppwc
    

    Or grab it via ComfyUI Manager by searching "PPWildCard", then restart ComfyUI. It'll show up in the HSKOWildcard category with its siblings. Three lines of logic, zero install risk - exactly the kind of node you'd rather have wired in than forget about.

    CategoryHSKOWildcard

    Inputs (1)

    NameTypeDefaultDescription
    inputSTRING

    Outputs (1)

    NameTypeDescription
    outputSTRING