Wildcard replace
A wildcard picker that lives inside the node — no .txt files needed
- output
PPWCReplace is the heart of the PPWildCard pack, and its defining trick is right in the pack's README: wildcard prompting that works solely in the workflow. Most wildcard systems - Impact Pack's __wildcard__ syntax, ComfyUI-dynamicprompts - read their options from *.txt files on disk, so your options live in a folder you have to keep in sync with your graph. PPWCReplace keeps the candidate list in a text widget on the node itself. Type your options, pick one at random per run, done. The whole workflow is self-contained in the JSON you share.
The mechanism is simple and, once you see it, predictable. The wildcard_list box holds one candidate per line; a line that starts with # is a comment, a line starting with | is a weighted entry like |2.0|some option (that one is twice as likely to be picked), and the special line NOPROMPT means "if you land here, remove the matched tokens entirely." The seed input drives a random.Random(seed).choices() call, so a fixed seed gives you a reproducible pick - useful when you want to lock a batch to a known set of combinations.
Then comes the part that catches people. The node doesn't do text surgery on a raw string - it tokenizes everything on commas, strips whitespace, and drops empty tokens. So replace isn't a phrase to find, it's one or more comma-separated tokens. Every token you list in replace has to show up somewhere in input (in order, as a subsequence) for the swap to happen; if even one is missing, the node does nothing rather than a partial job. When it does fire, the matched tokens are removed and the winning line is injected at the first match position. Practically: match single tokens - replace: "hair", candidates like blonde hair, short hair - and you'll rarely hit the edge cases.
The inputs that matter:
replace- the comma-separated token(s) to find in the prompt.wildcard_list- one candidate per line, with optional weights andNOPROMPT.seed- the random seed for the pick.input- the prompt string, wired in (it's forced to be a connection, so no typing here).
The one output, output, is the rewritten prompt string, ready to feed the next node - usually a PPWCLoraDetector to gate LoRA strength on what was chosen, or PPWCTerminate to clean up leftovers.
The tradeoff is worth stating plainly: keeping options on the node makes workflows shareable, but you can't reuse one wildcard library across many workflows, and the widget grows ugly once a list gets long. If you maintain a big shared wildcard folder, Impact Pack's approach is still the better default. If you want a batch workflow you can drop on someone as a single file, this wins.
Install is one step, and the pack has no dependencies at all:
cd ComfyUI/custom_nodes
git clone https://github.com/kohs100/comfyui-ppwc
Or use ComfyUI Manager and search "PPWildCard". Restart ComfyUI and the node appears under the HSKOWildcard category. No models, no requirements file, no hidden setup.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| replace | STRING | Enter a token to replace. | |
| wildcard_list | STRING | Enter a prompt using wildcard syntax. | |
| seed | INT | 00–18446744073709550000 | Determines the random seed to be used for wildcard processing. |
| input | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | STRING | — |