Multi Find And Replace (Soze)
Ten find/replace passes in one node
- STRING
This is the node you reach for instead of chaining ten separate "find and replace" nodes across your graph. One input_string goes in, up to ten find/replace pairs get applied, and one cleaned-up string comes out - useful for swapping placeholder tokens like {SUBJECT} for a real value pulled from elsewhere in your graph, standardizing inconsistent trigger-word casing, or stripping words you don't want reaching an API-based node further downstream.
How it works
Each pair - find_text1/replace_text1 through find_text10/replace_text10 - is a straightforward literal text substitution. There's no regex flag exposed anywhere in the node, so treat these as exact-text matches, not patterns. Leave a pair blank and it's a no-op; you don't need to fill all ten.
One thing worth keeping in mind: the passes apply in the order you filled them. If pair 1's replacement text happens to contain something pair 2 is also searching for, pair 2 can catch that newly-introduced text too. It's rarely a problem in practice, but if a replacement isn't behaving the way you expect, check whether an earlier pair changed the string in a way that fed the next one something unintended.
The inputs and output that matter
- input_string - the text you're transforming.
- find_text1..10 / replace_text1..10 - up to ten literal find/replace pairs, applied in order.
The single output is STRING - the fully processed text, ready to wire into a CLIPTextEncode, a filename builder, or another string node further down the chain.
A concrete example: you're pulling a prompt template out of a shared text file with {SUBJECT}, {STYLE}, and {LOCATION} placeholders in it - maybe fed in by Load Random Line From Text File. Set find_text1 to {SUBJECT} and replace_text1 to whatever a String Splitter handed you off a filename, find_text2 to {STYLE} and replace_text2 to a value from a dropdown, and so on. One node fills the whole template in a single pass instead of three chained replace nodes cluttering the graph.
Installing it
ComfyUI Manager: search ComfyUI_Soze. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/SozeInc/ComfyUI_Soze.git, pip install -r ComfyUI_Soze/requirements.txt, restart. Pure string handling - no models, no API keys, no dependencies beyond the pack itself.
Common issues
Case sensitivity: there's no toggle for it here, so assume exact-case matching - if your find text doesn't hit and you're sure the word is in there, check for a case mismatch first. And since each find_text/replace_text field is single-line, this node is built for token-style substitutions, not multi-line block replacement - for that, you'd want to restructure with this pack's Multiline Concatenate node instead and build the string up in pieces rather than search-and-replace across a big block.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| input_string | STRING | — | |
| find_text1opt | STRING | — | |
| replace_text1opt | STRING | — | |
| find_text2opt | STRING | — | |
| replace_text2opt | STRING | — | |
| find_text3opt | STRING | — | |
| replace_text3opt | STRING | — | |
| find_text4opt | STRING | — | |
| replace_text4opt | STRING | — | |
| find_text5opt | STRING | — | |
| replace_text5opt | STRING | — | |
| find_text6opt | STRING | — | |
| replace_text6opt | STRING | — | |
| find_text7opt | STRING | — | |
| replace_text7opt | STRING | — | |
| find_text8opt | STRING | — | |
| replace_text8opt | STRING | — | |
| find_text9opt | STRING | — | |
| replace_text9opt | STRING | — | |
| find_text10opt | STRING | — | |
| replace_text10opt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |