EmAySee Text Replace 20
Twenty find-and-replace pairs in one node, applied in order
- STRING
Search and replace for your prompt text, twenty pairs deep. EmAySee Text Replace 20 takes one text input plus 20 find_/replace_ pairs, runs every non-empty find against the text in order, and returns the result. If you've ever wanted to clean up an LLM's output ("the" → "the", "a " → "a "), normalize synonyms, swap model-specific tokens, or do prompt templating with placeholder replacement, this is the node - and twenty pairs means you can do a whole normalization pipeline in one box.
The order matters, and it's the thing most people miss: replacements are applied sequentially, so replace_1 runs on the original text, then replace_2 runs on that result, and so on. That's a feature - it lets you chain transformations (insert a token, then fix the token) - but it also means a pair can undo or re-transform what an earlier pair did. Plan the order like a pipeline, not a set of independent swaps.
How it works
Trivial under the hood:
for i in range(1, 21):
find_text = kwargs.get(f"find_{i}", "")
replace_with = kwargs.get(f"replace_{i}", "")
if find_text:
text = text.replace(find_text, replace_with)
Empty find strings are skipped, so you can leave unused pairs blank. Python's str.replace is substring-based and global - every occurrence gets replaced, not just the first, and there's no regex. If you need regex (pattern-based) replacement, this isn't the node; that's a different pack's job.
Inputs and output
text(multiline) - the string you're transforming.find_1…find_20- the substrings to look for.replace_1…replace_20- what each gets replaced with. Leave both blank in a pair to skip it.
Output is a single STRING - the transformed text. Feed the result into a CLIP Text Encode, a Text Combiner, or another Text Replace node for a second stage.
Installing it
One of the ~60 nodes in ComfyUI_EmAySee_CustomNodes. Install via ComfyUI Manager (search "ComfyUI_EmAySee_CustomNodes") or git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes into custom_nodes/, then restart. No dependencies, no models.
Where people get burned
Three classic traps, all from the plain-substring design:
- Substring collisions.
find = "a"will match the "a" inside every word. For exact token replacement, include the surrounding punctuation or spaces in your find string ("(a)", ", a", etc.). - Order dependence. Because later pairs run on earlier results, a pair that re-introduces text another pair just replaced will make the output look wrong in a way that's hard to spot. Read the pairs top-to-bottom as a script.
- No regex, no case-insensitivity.
"A"and"a"are different strings here. If your upstream text varies in case, normalize case first or list both variants.
And the meta-gotcha: twenty pairs of blank inputs is a lot of empty widgets. Most workflows use three or four pairs. The empties are harmless, but they make the node big on the canvas - if you only need two swaps, a plain two-pair replace node (or doing it in the prompt itself) keeps the graph tidier.
Inputs (41)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| find_1 | STRING | — | |
| replace_1 | STRING | — | |
| find_2 | STRING | — | |
| replace_2 | STRING | — | |
| find_3 | STRING | — | |
| replace_3 | STRING | — | |
| find_4 | STRING | — | |
| replace_4 | STRING | — | |
| find_5 | STRING | — | |
| replace_5 | STRING | — | |
| find_6 | STRING | — | |
| replace_6 | STRING | — | |
| find_7 | STRING | — | |
| replace_7 | STRING | — | |
| find_8 | STRING | — | |
| replace_8 | STRING | — | |
| find_9 | STRING | — | |
| replace_9 | STRING | — | |
| find_10 | STRING | — | |
| replace_10 | STRING | — | |
| find_11 | STRING | — | |
| replace_11 | STRING | — | |
| find_12 | STRING | — | |
| replace_12 | STRING | — | |
| find_13 | STRING | — | |
| replace_13 | STRING | — | |
| find_14 | STRING | — | |
| replace_14 | STRING | — | |
| find_15 | STRING | — | |
| replace_15 | STRING | — | |
| find_16 | STRING | — | |
| replace_16 | STRING | — | |
| find_17 | STRING | — | |
| replace_17 | STRING | — | |
| find_18 | STRING | — | |
| replace_18 | STRING | — | |
| find_19 | STRING | — | |
| replace_19 | STRING | — | |
| find_20 | STRING | — | |
| replace_20 | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |