String List from Text
Multiline text into a list, with wildcards for free
- strings
- count
String List from Text turns a wall of multiline text into a proper list of strings, one item per line, with two useful bonuses: {option|option|option} wildcards get randomly expanded, and a seed makes that randomness reproducible. It's the front end of the pack's prompt-batching story - type ten prompts, get a list of ten, feed the list into a batch or loop. If you've ever wanted ComfyUI's dynamic-prompts-style wildcard behavior without installing a separate dynamic prompts pack, this node does a solid job of it in one place.
How it works
The implementation is small and transparent. It splits the input on newlines, strips each line, and skips empty ones. For every line, it runs a wildcard expansion that repeatedly matches {...} groups and randomly picks one pipe-separated option - the loop handles nested wildcards, so a {red {dark|light}|blue} cat resolves too. The seeding is the subtle part: seed=0 means "truly random each run," while any non-zero seed makes expansion deterministic and derives a per-line variation (seed + line index) so each line gets different random picks that still reproduce run to run. Empty lines are skipped, so you can format freely.
Inputs and outputs
text(required, multiline) - one item per line; use{a|b|c}for random selectionseed(required) - 0 = random each run, non-zero = reproducible
Outputs:
strings- the list (STRING list)count- how many items ended up in the list
That count output is genuinely handy for looping - clamp a loop's iteration count to it and you'll never run past the end of your prompt list.
Where it fits
Pair it with String List Combine to merge several prompt sources, or with the pack's loop nodes to iterate every line as its own generation. It's a nice replacement for the "one prompt per batch row" workflow when your prompts are better expressed as text.
Install and quirks
Pack install via ComfyUI Manager (search "Latent Astronaut Suite") or:
cd ComfyUI/custom_nodes
git clone https://github.com/latentastronaut/comfyui-latent-astronaut-suite
Restart. No dependencies beyond Python's stdlib (random and re). The one thing that trips people: seed=0 is explicitly "random," so if you want reproducible runs, use any non-zero seed. And since each line gets its own derived seed, two lines with identical wildcard syntax will expand differently even under a fixed seed - that's by design, but it surprises people expecting one global random draw.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | a {red|blue|green} cat a {happy|sad} dog a flying bird | One item per line. Use {a|b|c} for random selection. |
| seed | INT | 00–18446744073709550000 | Seed for wildcard randomization (0 = random each time) |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| strings | STRING | — |
| count | INT | — |