Nodes/WebUI Monaco Prompt/WebuiMonacoPromptReplace
ComfyUI Node

WebuiMonacoPromptReplace

Find-and-replace a prompt tag across your whole workflow

By Taremin·Created 4 years ago·Updated 13 days ago· 29
WebuiMonacoPromptReplace

      The rename problem. You've been calling a character sailor girl in a dozen prompt boxes, then a better tag shows up and now every one of them is wrong. Or you pasted a workflow where half the tags are masterpiece_with_underscores and you know those underscores are quietly hurting you. Doing that by hand, box by box, is miserable. WebuiMonacoPromptReplace is VSCode's Ctrl+H aimed at your whole workflow at once.

      It's the sibling of the pack's WebuiMonacoPromptFind - in the source, WebuiMonacoPromptReplace is literally a Python subclass of it, an empty shell whose real body lives in the frontend. Where Find gets a search box and a results table, Replace adds a second input. Type what you're looking for, type what you want instead, hit Enter, and it rewrites every matching editor in the graph in one pass. It's the same WebUI Monaco Prompt pack by Taremin that swaps ComfyUI's prompt textareas for the Monaco editor; this node is the graph-wide edit tool that rides on top of it.

      How it works

      The Python class does nothing - no inputs, no outputs, no process that returns anything. When the node is created, the pack's prebuilt frontend bundle replaces it with a widget that carries a Find box and a Replace box, plus the same three toggles as Find: case-sensitive, whole-word, and regex. On Enter it finds every match across all the Monaco editors the pack manages (including tabs inside WebuiMonacoPromptMultiText nodes) and applies Monaco's executeEdits to each one.

      Regex replace is the hidden gem. The replacement runs through JavaScript's String.replace, so capture groups work: search for (\w+)_uniform and replace with $1_school_uniform across the whole graph. That's genuinely useful for normalizing tag vocabulary, and it's the kind of thing no stock ComfyUI tool does.

      The one thing to watch

      Replace is destructive, and there's no preview and no confirm. Find highlights matches without touching anything; Replace commits the moment you press Enter. Each editor keeps its own undo history, so Ctrl+Z inside a single node can roll back that node's changes, but a graph-wide swap is a bulk operation - don't expect one keystroke to undo all of it.

      That's why the two nodes are designed to work as a pair, and the workflow is obvious once you see it: run WebuiMonacoPromptFind first, eyeball the highlighted hits, then add WebuiMonacoPromptReplace and commit. Find to check, Replace to commit. If you're not sure your regex matches what you think it matches, Find tells you in one Enter.

      Good jobs for it: renaming a repeated tag, stripping (easynegative)-style noise from a batch of inherited prompts, or the underscore cleanup - and if that last one is your habit, the pack even ships a "Replace Underscore" editor setting for doing it on the fly.

      Installing it

      Same pack as Find - you get both in one install, plus the editor itself.

      cd ComfyUI/custom_nodes
      git clone https://github.com/Taremin/webui-monaco-prompt
      

      Restart ComfyUI and it appears in the WebuiMonacoPrompt category. ComfyUI Manager users can search "webui-monaco-prompt" instead. No Python dependencies, no models to download, no build step - the frontend ships prebuilt in the repo, tag CSVs included.

      Troubleshooting

      Two gotchas, both shared with Find. Replace only touches editors the pack actually manages - it works on every prompt box because the "Replace Textarea" setting (on by default) converts them all to Monaco. Disable that setting and there's nothing to replace. And because this is a frontend widget node, ComfyUI's own UI updates can break it - the same class of breakage that hit DOM-widget packs like rgthree during the Nodes 2.0 rollout. ComfyUI support is author-labeled "Experimental" here, and the maintainer's focus is the A1111 side.

      One honest verdict: it's a niche tool you won't use every day. But the day you need to rename a tag across a thirty-node workflow, it turns a twenty-minute chore into a ten-second one, and that's a good trade.

      CategoryWebuiMonacoPrompt

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs