BracketCleaner
Cleaning (Parentheticals) Out of Scripts
- STRING
BracketCleaner does exactly one thing: it removes everything wrapped in parentheses from a block of text and returns what's left. The canonical use case is script-to-video. If you've ever fed a screenplay into an LLM or a video workflow, you know the output comes back littered with (Studio lights up) and (Cut to a graphic) - stage directions that describe what's on screen but completely pollute a dialogue-only prompt. This node strips all of that and leaves you with clean lines of dialogue.
It's a text node in a pack best known for video effects, and it's a small one. But in a script-to-video pipeline it sits in exactly the right place: run the script through it, and the text that hits your prompt encoder is all dialogue, no clutter.
How it works
The implementation is refreshingly honest - it's a regex. It splits the input into paragraphs, removes anything matching \(.*?\) from each paragraph, and rejoins the survivors with blank lines preserved. So paragraph structure survives; only the bracketed content goes.
That means it's a blunt tool, not a smart one. It matches any parenthetical, including the ones you might want to keep. If your script has a quoted aside like (whispering) as part of the dialogue you actually want, it's getting removed too. There's no whitelist, no AI judgment - it's a scythe.
The inputs that matter
text- a multilineSTRINGinput. Paste your script or wire it from a text loader node.- Output: a single
STRINGwith the brackets stripped.
That's the whole surface area. Nothing to tune, nothing to break. In a workflow you'd typically chain it after a text-loading node and before whatever feeds your prompt.
Installing it
BracketCleaner is one of the 75+ nodes in DJZ-Nodes, so install the pack once:
cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt
Or use ComfyUI Manager and search "DJZ-Nodes". There are no extra model downloads - this is pure string processing, so it works out of the box once the pack is installed and ComfyUI is restarted.
Common issues
Two gotchas worth knowing. First, it strips all parentheses, so if your text uses (text:1.2) style prompt-weighting for emphasis, those weights vanish - don't run this on a prompt you're actively tuning. Second, it only touches parentheticals, not square brackets [ ] or braces { }, so if your captions use those for something you want gone, this node won't touch them. For most script-cleaning jobs that's fine. For anything fancier, you'd want a regex node that gives you control - BracketCleaner is deliberately the simple, predictable option.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |