Tag Replace [LP]
Fuzzy find-and-replace for tag strings, not exact-match
- result
This pack already has a plain Tag Remover for when you know the exact tag text you want gone. Tag Replace is a different tool for a different problem: it swaps tags out based on approximate matching, controlled by a threshold, rather than requiring the input to match character-for-character.
What it does
You give it a tag string, a set of replacement tags, and a match value that acts as a similarity threshold - the lower the number, the looser the matching. This is a fuzzy-replace, not an exact one, which is the whole point: real-world tag sets are messy. Autotaggers spell things slightly differently between runs, people mix blue_sky and blue sky in the same dataset, and near-duplicate or misspelled variants sneak through. A node that requires an exact string match (like this pack's Tag Remover) won't catch any of that; a fuzzy-match tool with an adjustable threshold will, at the cost of being less predictable if you set the threshold too loose and it starts matching tags you didn't mean to touch.
The exact matching algorithm behind match isn't documented in the README or the schema, so treat the default of 0.3 as a starting point to tune rather than a value to trust blind - test on a tag string where you know exactly which tags should and shouldn't get swapped, and adjust from there.
Inputs and outputs that matter
tags(required, defaults to empty) - the tag string you're editing.replace_tags(required, defaults to empty) - the replacement tags.match(required, float, default0.3) - the similarity threshold controlling how loose or strict the fuzzy matching is.
Output: result - the tag string after replacement.
Installing it
Through ComfyUI Manager, search "ComfyUI Level Pixel" or "ComfyUI-LevelPixel." Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git
Restart ComfyUI. No models, no extra dependencies - text processing only.
Common issues & troubleshooting
Tags get replaced that you didn't expect to match. This is the classic fuzzy-matching trap - set match too loose and it starts catching tags that are only superficially similar to what you actually wanted to target. If replacements feel unpredictable, tighten the threshold (raise the value) and re-test rather than assuming the node is broken.
A tag you expected to get replaced didn't. The opposite problem - the threshold is too strict for how different your tag text is from what you're matching against. This is especially likely if you're trying to catch both underscore and space variants of the same tag, or minor misspellings, in one pass; nudge the threshold down incrementally rather than jumping straight to a very loose value.
You actually wanted an exact match, not fuzzy. If you know the precise tag text and don't want any approximate-matching surprises, this pack's plain Tag Remover (exact string match) or Tag Category Remover (category-based, not text-based) are more predictable tools for that job. Reach for Tag Replace specifically when your input data is inconsistent enough that exact matching would miss things.
Multiple replacement targets in one pass. The schema only exposes single tags/replace_tags/match fields, not numbered pairs the way this pack's Text Replace node does for plain text. For several distinct fuzzy replacements, you'll need to chain Tag Replace nodes one after another.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| tags | STRING | — | |
| replace_tags | STRING | — | |
| match | FLOAT | 0.30 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | STRING | — |