APZmedia Dictionary Based String Replacement
'key' | 'value' lines, with a body count
- input_text
- replaced_text
- replacement_count
Every naming pipeline eventually needs a translation layer: the client calls it "ACME Sneakers," your DAM calls it ACME-SNKRS, and the folder you save into calls it SNK. Doing that by hand every run is a job for a node, not a human. APZmedia Dictionary Based String Replacement is the APZmedia Naming Tools answer - a find-and-replace that lives in a plain-text dictionary you can actually read and update.
The format is exactly what the default widget shows:
"key" | "value"
"another key" | "another value"
Quoted key, pipe, quoted value, one pair per line. Each occurrence of a key is replaced with its value, and here's the part the pack gets right: it also outputs a replacement_count (INT) so you know the thing actually did something instead of silently doing nothing. That's a genuinely useful habit - wire it into a debug display and you'll catch typos in your dictionary immediately.
The two inputs are input_text (typed as *, so it accepts any type - numbers, strings, whatever - and coerces to string) and the multiline dictionary. Outputs are replaced_text (STRING) and replacement_count (INT).
Three mechanism details matter in practice. First, lines that don't match the quoted format are silently skipped - so a dictionary line missing its quotes just won't apply, no error, check your formatting. Second, replacements run in order top-to-bottom, and each later replacement operates on the result of the earlier ones, so "ACME" | "Acme" followed by "Acme" | "SNK" chains. Third, it's a plain string replace, not regex - the * is a literal asterisk to this node, which is usually what you want in a filename context.
Where this slots into the wider pack: sit it between your prompt text and a filename builder to normalize input before naming - turn "final", "FINAL", and "the real one" into v1 - or run client/product names through it before they hit the industry naming nodes. It also works fine for cleaning tag lists or batch-renaming prompt fragments before hashing. It's a utility, not a star, but it's the kind of node you start missing the day after you build a workflow without it.
Install
ComfyUI Manager → search "APZmedia Naming Tools". Or:
cd ComfyUI/custom_nodes
git clone https://github.com/APZmedia/ComfyUI-APZmedia-cleanName-from-string
cd ComfyUI-APZmedia-cleanName-from-string
pip install -e .
Restart, find it under APZmedia. No models, no downloads - the pack's only dependency is unidecode and this node doesn't even use it; it's pure standard-library re.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | * | — | |
| dictionary | STRING | "key" | "value" "another key" | "another value" | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| replaced_text | STRING | — |
| replacement_count | INT | — |