Replace List
Find-and-replace across a whole list at once
- replaced_list
Replace List runs a search-and-replace over every entry in a list, in one pass, and hands you the whole edited list back. It's the "clean up a batch of filenames or prompts" node - the kind of thing you'd otherwise do with a chain of per-item string nodes that makes your graph look like spaghetti.
Why you'd reach for it
Say you pulled a file list with Get File List and every filename has a -v2 suffix you want gone, or a prompt list where every entry needs a trigger word swapped for another. String-level Search and Replace works on one string at a time; this works on the whole list in one go, so the output stays a list you can feed straight into the next list node. That's the whole value proposition: batch string surgery without un-listifying.
How it works
It iterates the list and, per entry, does a plain str.replace by default, or a re.sub regex substitution if is_regex is on. Plain mode is exact substring matching - fast, predictable, no escaping surprises. Regex mode unlocks patterns, so you can do things like strip everything after the first underscore with _.*. The node's IS_CHANGED is set to always run, which means it re-executes even when inputs look identical - useful when it's fed from sources that mutate between runs.
The inputs that matter
- string_list - the list to transform. Must be a real list (from String To List, Get File List, etc.), not a single string.
- search_string - what to find.
- replace_string - what to replace it with. Empty string deletes the match.
- is_regex - off by default. Flip on to treat search_string as a regex.
One output:
- replaced_list - the transformed list, same length, same order. Wire it back into any list-consuming node.
Installing it
Part of TinyBee: ComfyUI Manager → Install Custom Nodes → search "ComfyUI-TinyBee", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
Under 🐝TinyBee/Lists. Stdlib only.
Common issues
A malformed regex will throw an error at runtime - the node doesn't validate your pattern for you, and re.sub doesn't sugar-coat a bad one. If you get a re.error, simplify the pattern or switch is_regex off. And remember it's a plain substring match in non-regex mode: searching "cat" will also hit inside "category". For whole-word swaps you want regex mode with word boundaries. If nothing seems to change, check that your list actually contains the search string - a mismatch between list contents and your search term is the most common "it's not working" report.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| string_list | STRING | — | |
| search_string | STRING | — | |
| replace_string | STRING | — | |
| is_regex | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| replaced_list | STRING | — |