Multi Replace Prompt
Find-and-replace, six rules, regex under the hood
- text
Multi Replace Prompt is Replace Prompt with the budget doubled: six find-and-replace rules (pattern_A/replace_A up to pattern_F/replace_F) applied in sequence to an incoming prompt. If you're normalizing downloaded workflows - stripping embedded quality tags, swapping model-specific vocab, cleaning up a dozen synonyms into your standard phrasing - one node with six rules beats a chain of three three-rule nodes every time.
How it works
Identical helper as its smaller sibling: for each non-empty pattern, it runs re.sub over the accumulated text, so rules cascade - rule B sees the output of rule A, rule C sees that result, and so on. The match toggles (match_full, match_case, match_regex) are the same as Replace Prompt's: matching is case-insensitive regex by default, and the toggles only shuffle flags rather than switching regex on and off. Treat every pattern as a regex and you won't be surprised.
Inputs that matter
- prompt - force-wired input text.
- pattern_A through pattern_F + the matching replace_X - six ordered rules. Empty patterns are skipped, so you can use two rules or all six.
- match_case, match_regex, match_full - flag toggles with the same caveats as Replace Prompt (
match_fulldoesn't mean whole-string matching).
One text output with all replacements applied.
Install
ComfyUI Manager → Custom Nodes Manager → search ComfyUI-PromptWrapper → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/clouddreamfly/ComfyUI-PromptWrapper
No dependencies, no models.
Where people get burned
Regex escaping, again, is the entire failure surface. Replacing the literal (best quality:1.2) needs \(best quality:1\.2\) because the metacharacters are live. And because rules cascade, order matters: if rule A turns "girl" into "woman" and rule B replaces "woman", the order in which you list them changes the result - that's a feature, but it means a confusing bug if you forget A runs first. One more thing worth knowing: the six rules share a single prompt input and a single output, so unlike some string tools there's no per-rule branching - think of it as a pipeline, not six independent replaces.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| pattern_A | STRING | — | |
| replace_A | STRING | — | |
| pattern_B | STRING | — | |
| replace_B | STRING | — | |
| pattern_C | STRING | — | |
| replace_C | STRING | — | |
| pattern_D | STRING | — | |
| replace_D | STRING | — | |
| pattern_E | STRING | — | |
| replace_E | STRING | — | |
| pattern_F | STRING | — | |
| replace_F | STRING | — | |
| match_full | BOOLEAN | false | — |
| match_case | STRING | false | — |
| match_regex | STRING | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |