LZ Prompt Replace Single
Swap one wildcard in your prompt from a CSV
- result
Wildcard-style prompt variation is one of the cheapest ways to build a batch of images that differ where you actually care - hair color, outfit, background, style - instead of diffusing them blindly and hoping. LZ Prompt Replace Single is the smallest version of that idea: one template, one placeholder, one CSV file, and every execution picks a random line from the CSV and substitutes it.
It's the A1111-wildcard trick that the KB's prompt-engineering doc notes most post-2024 users never learned, reborn as a plain node. If you want "a young woman in front of a church with _hair_" to become brown, blonde, or black hair across a run of images, this is the node that makes it happen without touching the prompt between generations.
How it works
Three inputs, one output:
template(multiline) - your base prompt with a placeholder marker wherever the variation goes._hair_is the suggested default.placeholder- the exact marker string to replace. Default_hair_, but it can be anything:__subject__,{pose}, whatever you like. It's a literal string replace, not regex.csv_file- a dropdown listing the.csvand.txtfiles sitting in yourComfyUI/output/prompt_csv/folder. Each non-empty line is a candidate.- Output:
result- the template with the placeholder swapped for one randomly chosen line.
On each execution the node picks one option with random.choice. Run the workflow repeatedly (or loop it), and each image gets a different pick. If no CSV is selected or the file is empty, it passes the template through unchanged - a quiet no-op, so don't expect an error when you've forgotten the file.
The folder gotcha
This is the one that bites everyone: the CSV dropdown only lists files inside output/prompt_csv/, and that folder doesn't exist until the node first runs (the pack creates it for you). If you dump your CSV in Documents or models/loras, it will never show up in the dropdown. Drop it in prompt_csv/, refresh the node list (or restart), and it appears. Plain .txt with one option per line works too - you don't actually need CSV formatting.
Why it's worth having
Beyond the obvious batch-variation use, it's a handy way to keep a prompt library as data instead of code. Your artists, poses, lighting, or character traits each live in their own file, and the template says where they slot in. Wire the result into a text encoder and you're generating variations the whole session without re-typing a prompt.
One caution from the KB: wildcard-style randomization is great for CLIP-encoded models (SD 1.5, SDXL, Illustrious, Pony), and harmless on LLM-encoded models (Flux, Anima, Z-Image) as long as your placeholder text reads like normal words once substituted. Keep the placeholders short and clean and it behaves on both.
Installing it
Part of the ComfyUI-LZNodes pack:
cd ComfyUI/custom_nodes
git clone https://github.com/liz-ils/ComfyUI-LZNodes
Restart ComfyUI, or use Manager → search "ComfyUI-LZNodes". No dependencies beyond stock ComfyUI.
If you have more than one slot to fill per prompt, skip the single version - LZ Prompt Replace Multi does five placeholder/CSV pairs in one node, and LZ Prompt Replace String does the same without needing a file at all.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| template | STRING | — | |
| placeholder | STRING | _hair_ | — |
| csv_file | COMBO | 1 options: |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | STRING | — |