Does not contain
Gating workflows on what is NOT there
- result
Sometimes the condition you care about is an absence. "Only run this if the prompt does not mention blur." "Skip the sharpening pass if the model tag doesn't contain detail." You could build that with a Contains node plus a Not node in series - but this pack saves you the extra node, because it ships the negated version ready to go.
Does not contain is part of ComfyUI-BooleanExpression, Marco Zanella's no-dependency logic pack. It's the twin of the pack's Contains: same three inputs, same shape, one flipped sign. Its whole job is to return true when the search string is missing from the text, and false when it's present.
How it works
Mechanically it's needle not in haystack, with an optional lowercase pass on both sides first. Pure Python, zero dependencies, no models, no network. It's a string test that resolves in microseconds - the kind of node you can drop into a workflow mid-build and never think about again.
The inputs:
- haystack - "The string." What you're searching.
- needle - "The string to search." What you hope is not there.
- case_insensitive - defaults to True.
Because case folding is on by default, "Blur" and "blur" are treated as the same substring - which means "BLURRY" does contain "blur" once lowercased, so this node returns false for it. That's the behavior you want for keyword gating. Note the empty-needle edge case from the other direction: if needle is empty, this node returns false always (an empty string is in everything), so guard against blank needles.
Output is a single result boolean, ready for the pack's Conditional Branch or the And/Or/Xor/Not nodes.
Why you'd reach for this instead of Contains + Not
Two reasons, and they're both about reading your graph. First, fewer nodes. ComfyUI graphs get dense fast, and the community's honest complaint about utility packs is that they turn a readable graph into spaghetti. One node doing "not contains" is easier to scan than two. Second, intent - "Does not contain" states what you mean, which matters when you come back to a workflow in three weeks and can't remember why that Not node is there.
Real use: negative-condition prompt routing. ComfyUI already has negative prompts, but that's a sampler-level concept. This node lets you make workflow-level decisions on absence - e.g., if the prompt doesn't mention "no people", keep the character LoRA in the graph. It's the text version of gating logic that people on r/comfyui build constantly when they want one workflow to handle multiple intents.
Install
Via ComfyUI Manager, search ComfyUI-BooleanExpression, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/marco-zanella/ComfyUI-BooleanExpression.git
Restart ComfyUI and it's under Boolean Expressions → String Comparisons. The pack has an empty requirements.txt and downloads nothing - install is restart-and-go, and Manager finds it on the Comfy Registry by title.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| haystack | STRING | The string. | |
| needle | STRING | The string to search. | |
| case_insensitive | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | BOOLEAN | — |