Text Modify Tool
A search-and-replace sidekick for this pack's loaders
- STRING
Text Modify Tool is the pack's little text-edit utility, and it's best understood as a filename scrubber. It takes one string in, runs a search-and-replace on it, and hands back one string out. Its natural home is sitting between a batch loader and a batch saver - say, cleaning up a filename the Image Batch Loader handed you before you use it as an output prefix.
Let's be blunt about it: as a general text node it's nothing special, and if all you need is to munge arbitrary strings there are beefier packs (WAS Suite, rgthree, and friends) with more knobs. Where this one earns its keep is that it's tuned for the job this pack actually does - tidying names - and it chains cleanly with the loaders on either side. It's also the least-used node in the pack, so you're probably here because a workflow you downloaded references it. That's fine; it works.
How it works
Three inputs drive it: input_text, search, and change_to. If search is empty, it skips straight to rebuilding the text from change_to; otherwise it replaces every match of search with change_to. The delete toggle turns change_to into "replace with nothing" - a quick way to strip a word out of a filename without typing an empty string.
option decides where the edit applies:
whole texts- replaces across the whole string, with one important quirk: it treats the input as a filename and strips the extension first (viaos.path.splitext). Feed itphoto_v2.pngand it editsphoto_v2, not the extension. That's intentional, and it'll bite you if you feed it prompt text and wonder where your punctuation went.prefix- only edits the part before the first separator. Ifdelimiteris empty it auto-detects one of-,_,--, or#.suffix- same idea, but the part after the last separator.
The single output is STRING, and it just flows into whatever text input you're feeding - a prompt field, a saver's contents, a show-text node.
Installing it
It's part of Zar4X/ComfyUI-Batch-Process, installed like the rest of the pack. In ComfyUI Manager search ComfyUI-Batch-Process, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Zar4X/ComfyUI-Batch-Process
Then restart. Dependencies are just Pillow and torch, which ComfyUI already has.
Troubleshooting
The classic confusion is the extension stripping in whole texts mode - if your output looks truncated, that's the os.path.splitext behavior, not data loss. Second gotcha: with prefix or suffix and no delimiter, it auto-guesses separators from a hardcoded list, so a filename separated by, say, a space won't split the way you expect. If you need reliable splits, pass an explicit delimiter instead of letting it guess. And if nothing changes, double-check delete - it's easy to leave on and watch your replacement silently become a removal.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | STRING | — | |
| searchopt | STRING | — | |
| change_toopt | STRING | — | |
| delimiteropt | STRING | — | |
| optionopt | COMBO | whole texts | 3 options: whole texts, prefix, suffix |
| deleteopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |