Custom Wildcard Prompt
A simple wildcard prompt node with seed control and debug output.
Custom Wildcard Prompt
A lightweight ComfyUI node that turns {option one|option two|...} blocks in your prompt into randomly selected values — one pick per generation, or several if you use multiple blocks. Works with any model (SD, SDXL, Flux, Qwen, etc.) and can be wired into any text input, including positive or negative prompts.
Features
- Wildcard syntax:
{option one|option two|etc} - Seed control: fix the seed to freeze the selection, or let it vary per generation.
- Multiple blocks per prompt: each
{...}block is resolved independently. - Debug output: a second
STRINGoutput shows exactly which options were selected, so you can see what the model actually received. - Bracket safety check: if
{and}counts don't match, the node returns the original text plus a syntax-error message instead of silently producing garbage.
Syntax
{option one|option two|option three}
- Options are separated by
|. - Whitespace around each option is trimmed.
- Nesting is not supported — the regex matches only the innermost
{...}without inner braces. - Empty options are dropped.
Live examples
Clothing and color
a woman wearing {a red silk dress|a blue denim jacket|a white linen shirt}, {standing on a beach|sitting in a café|walking through a forest}
Pose and emotion
portrait of a man, {smiling softly|looking away|eyes closed}, {arms crossed|hands in pockets|leaning against a wall}
Background
{cyberpunk city at night|sunlit Italian villa courtyard|misty mountain lake}, cinematic lighting
Negative prompt
{blurry|low quality|extra fingers|watermark}
Each generation picks one option per block. With two blocks above, you get 3 × 3 = 9 possible combinations per prompt.
Seed behavior
- Fixed seed → the same options are selected every run.
- Randomize / increment seed → a new combination is chosen each generation, like any other ComfyUI node with a seed input.
- The node uses a local
random.Random(seed)instance, so it does not disturb the global random state used by other nodes.
Installation
Via ComfyUI Manager
Search for Custom Wildcard Prompt in the Manager and install.
Manual (from console)
cd ComfyUI/custom_nodes
git clone https://github.com/eliseipanov/custom-willdcard-prompt.git
Then restart ComfyUI.
Note: the repository URL above is spelled
custom-willdcard-prompt(withwilld). If you rename the repo later, update this line and theRepositoryfield inpyproject.toml.
Usage
- Add the node 🛠️ Custom Wildcard Prompt (category:
utils/custom). - Type your prompt with
{...}blocks into thetextfield. - Connect the
final_promptoutput to the text input of a text encoder, not directly to the sampler. The encoder converts the string intoCONDITIONING:- Qwen Image 2.1: connect
final_prompt→promptinput ofText Encode Qwen Image 2.1, then itspositiveoutput → sampler'spositive. - SD / SDXL / Flux: connect
final_prompt→textinput ofCLIP Text Encode, then itsCONDITIONINGoutput → sampler'spositive.
- Qwen Image 2.1: connect
- The
debug_infooutput is a plainSTRINGfor display only. Connect it to a text viewer such asPreview AnyorShow Textto see which options were selected. Do not connect it to the sampler or encoder. - For a negative prompt, repeat the same pattern:
final_prompt→ text encoder → sampler'snegative.
final_prompt (STRING) → Text Encode (Qwen 2.1 or CLIP) → positive (CONDITIONING) → Sampler
debug_info (STRING) → Preview Any / Show Text (display only)
<img width="1105" height="406" alt="custom-wildcard-prompt" src="https://github.com/user-attachments/assets/dd4e3e80-0572-4fec-a77e-628d121ccbd0" />
*(Screenshot How-to-Use Example)*
Outputs
| Output | Type | Description |
|---|---|---|
| final_prompt | STRING | The prompt with all {...} blocks resolved. |
| debug_info | STRING | A ✅ Selected: ... summary of the chosen options, or a syntax-error message. Usefull with Show Any Node or other text/string preview nodes |
Roadmap
- Priority option — prefix an option with
^to force it to always be chosen, e.g.{Option one|^Option two|etc...}. Useful when you've found the best variant (e.g. a lighting setup you liked in Qwen Edit 2.1) but don't want to delete the others yet. The^stays until you remove it. - Comment blocks — wrap any part of the prompt in
/* ... */to exclude it from the output, including any{prompt|variants}inside. Useful for temporarily disabling a section without deleting and re-adding it, or for keeping notes next to the prompt. - Partial text locking — mark a section of the prompt as "do not randomize", so you can edit one part, compare, and restore it without losing the rest.
Contributing
Found a bug or have a suggestion? Please open an issue or a pull request on GitHub:
- Issues: https://github.com/eliseipanov/custom-willdcard-prompt/issues
- Pull requests: https://github.com/eliseipanov/custom-willdcard-prompt/pulls
License
MIT — see LICENSE.