🪠️ WWAA Search and Replace Multi
Batch find-and-replace for prompts
- modified_text
- processing_log
The single-pair search-and-replace node is fine until you need to fix ten things at once. WWAA Search Replace Multi is the version that takes a whole list of find/replace pairs and applies them all in one pass, in order. Think of it as the prompt-scrubbing stage of a pipeline: strip a bad token, normalize a word, fix a formatting quirk - one node, one run, done.
It's the kind of glue node that quietly solves a real problem. ComfyUI's text handling is full of places where you end up with prompts from different sources (LLMs, captioners, wildcards) that all need the same cleanup before they hit an encoder. Doing that with a chain of single-replace nodes works but makes your graph look like a plate of spaghetti; this collapses the whole cleanup into one config block.
How to write the pairs
text_input- the text to process (multiline).search_replace_pairs- one pair per line, formattedsearch;replace. The default even shows you the pattern:search1;replace1 search2;replace2 "text, with comma";"replacement"use_comma_format- if your searches or replacements legitimately contain commas or semicolons, flip this on and pair items get separated by commas instead of newlines (with quotes protecting the semicolons inside each pair). The line format alone can't handle a search containing a;- that's what this toggle exists for.- Outputs:
modified_text(the result) andprocessing_log(a string summarizing what got replaced - genuinely useful when a replacement didn't fire and you need to know why).
Two behaviors worth knowing. Replacements run sequentially in the order you list them, so pair order matters - replace old → new before new → fancy, not after, or the second swap undoes the first. And quoted values are parsed like CSV, which is how you sneak commas and special characters into either side. Malformed lines are skipped with a warning to the console rather than crashing the whole node, which is merciful when you're pasting in a long list.
Install
From the WWAA-CustomNodes pack. ComfyUI Manager: search "WWAA Custom Nodes" → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/hgabha/WWAA-CustomNodes
# restart ComfyUI
No extra dependencies (stdlib + ComfyUI's stock numpy/Pillow/torch), no models. Under the 🪠️ WWAA/String menu.
Honest take
It's a quality-of-life utility: not flashy, but the sequential-multi-replace pattern is one you'll reach for constantly once you've got it, especially in LLM-assisted prompt pipelines where you're normalizing machine output. The line format is easy to screw up on the first try (forgetting the ;, or a stray comma confusing the parser) - but the log output tells you exactly what happened, so the failure mode is diagnosable rather than mysterious. For batch text cleanup inside a workflow, this is the one you'll actually use.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text_input | STRING | — | |
| search_replace_pairs | STRING | search1;replace1 search2;replace2 "text, with comma";"replacement" | — |
| use_comma_format | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| modified_text | STRING | — |
| processing_log | STRING | — |