Text Replace [LP]
Up to nine find-and-replace pairs in one node
- text TEXT
Chaining nine separate find-and-replace nodes to clean up one string is the kind of thing that makes a graph unreadable fast. Text Replace collapses that into one node with nine numbered find/replace pairs, so a whole pass of substitutions happens in a single box instead of sprawling across the canvas.
What it does
Feed it a block of text and up to nine findN/replaceN pairs, and it applies each substitution to the string, handing back the result. This is exact-match, plain-text replacement - no wildcards, no regex, no fuzzy matching (this pack's separate TagReplace-LP node is the fuzzy-threshold version, but it operates on tag strings specifically, not general text). Think templating: swap a placeholder like {{name}} for an actual value, strip out boilerplate phrases that keep showing up in generated captions, or normalize a handful of known-inconsistent spellings in one pass before the text moves on to a CLIP encoder or one of this pack's other text nodes.
The output type in the schema is a wildcard (*) rather than a plain STRING - a common trick in ComfyUI nodes to let the output socket connect into whatever input type is on the other end without the type-checker complaining, since under the hood it's still text.
Inputs and outputs that matter
text(required, multiline, defaults to empty) - the source text.find1/replace1throughfind9/replace9(all optional, single-line, default empty) - up to nine substitution pairs. Leave a pair empty and it's presumably skipped rather than replacing empty-string-with-empty-string.
Output: text TEXT - the text after all populated find/replace pairs have been applied.
Installing it
Through ComfyUI Manager, search "ComfyUI Level Pixel" or "ComfyUI-LevelPixel." Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git
Restart ComfyUI. Text processing only, no models or extra dependencies.
Common issues & troubleshooting
A replacement didn't fire. This is exact-match text, so anything less than a character-for-character match on findN won't trigger - different casing, an extra space, or a typo between what's actually in text and what you typed into findN will silently skip that pair rather than error. Copy the exact substring out of your source text if you're not sure it matches.
Order of operations matters and isn't obvious. With nine pairs available, it's easy to write two rules that interact - one replacement's output text happens to match a later findN and gets replaced again. If your result looks over-processed, check whether an earlier pair's replacement text is accidentally triggering a later pair.
You need fuzzy or pattern-based matching, not exact text. This node only does literal substring replacement. If you're working with tags specifically and need approximate matching to catch spelling variants, this pack's TagReplace-LP node (with its adjustable match threshold) is the right tool instead - just note it's built for tag strings under the Tags category, not general prose.
More than nine substitutions needed. Chain a second Text Replace node off the first one's output for additional pairs beyond the nine built in.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| find1opt | STRING | — | |
| replace1opt | STRING | — | |
| find2opt | STRING | — | |
| replace2opt | STRING | — | |
| find3opt | STRING | — | |
| replace3opt | STRING | — | |
| find4opt | STRING | — | |
| replace4opt | STRING | — | |
| find5opt | STRING | — | |
| replace5opt | STRING | — | |
| find6opt | STRING | — | |
| replace6opt | STRING | — | |
| find7opt | STRING | — | |
| replace7opt | STRING | — | |
| find8opt | STRING | — | |
| replace8opt | STRING | — | |
| find9opt | STRING | — | |
| replace9opt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text TEXT | * | — |