Filter Prompt
Strip words and tags out of a prompt, on autopilot
- string
You've got a prompt that mostly works but keeps dragging in one thing you don't want - a word, a tag, a whole phrase - and it's baked into an upstream node you can't easily edit. Filter Prompt removes matching words and phrases from a prompt automatically, with a wildcard syntax that handles the "long hair vs. very long hair" problem without you writing a regex.
What it is
A text-processing node that takes an input prompt and a list of filters, and returns the prompt with everything matching the filters removed. It's the removal half of prompt editing: feed it the output of a prompt builder or wildcard processor, and it cleans out the terms you've blacklisted before the CLIP encoder ever sees them.
The filter syntax is the star. Filters are comma- or newline-separated, and * matches exactly one word - the tooltip gives the money example: *hair matches "long hair," **hair matches "very long hair." Underscores and spaces are equivalent, so long_hair and long hair behave the same. If you've written Danbooru-style tags, this is immediately comfortable.
How it works
Two modes, chosen automatically:
- Tag format: if the input prompt looks like a comma-separated tag list, the node matches against whole tags. A matched tag is removed completely - no partial tag fragments left behind - and the remaining text is cleaned (extra commas collapsed, spaces normalized).
- Natural language: for sentence-style prompts it falls back to a phrase-removal engine that finds and deletes matching phrases while preserving sentence structure.
Patterns are compiled with regex under the hood, and there's a deliberate preference ordering: longer patterns match before shorter ones, and exact phrases beat wildcard phrases, so very long hair removes cleanly rather than half-matching long hair first. Matches are case-insensitive, and escaped parentheses are treated the same as plain ones (handy when a prompt wraps a term in (term:1.2) weighting).
The inputs that matter
- input_string - the prompt to filter (optional; if left unconnected, the node outputs an empty string).
- string - the filters, one per line or comma-separated, using the
*wildcard syntax. If empty, the input prompt passes through untouched.
Output
One output: string, the filtered prompt. Wire it into whatever would have received the original - a CLIP Text Encode, a Dual Text joiner, or a prompt-builder chain.
Install
Part of ComfyUI_Eclipse (formerly RvTools, rewritten in v4.0.0). Manager β ComfyUI_Eclipse β install β restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI_Eclipse
Under Eclipse β Text. No models or extra deps.
Troubleshooting
- A whole tag vanished: that's the design - in tag mode, matches remove the complete tag so a partial fragment never survives. If you wanted a word removed only inside a longer tag, use natural-language mode (don't format the input as tags).
*not matching what you expect: each*is exactly one word.**hairis two words before "hair"; three asterisks for three. Spaces and underscores are interchangeable, but punctuation inside a tag breaks the wildcard.- Prompt unchanged: the filters field is empty, or the input isn't a string type. Check both.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | Comma/newline-separated filters. Each * matches exactly one word; spaces and underscores are equivalent. Examples: *hair matches long hair, **hair matches very long hair. | |
| input_stringopt | STRING | Tag-based or natural-language prompt from which matching words and phrases are removed. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string | STRING | β |