Contains Word
A text-triggered switch for your workflow
- is_containing_the_word
Sometimes what you actually want out of a prompt or caption isn't more text - it's a yes/no. Does this caption mention "outdoor"? Did the wildcard picker land on "night"? Contains Word answers exactly that: feed it a block of text and a list of words to look for, and it hands back a plain BOOLEAN. That boolean is the useful part - pipe it into a switch node and you've got a workflow that branches based on what a string actually contains, instead of you eyeballing it and manually flipping a toggle.
The two inputs, and that's the whole node. text is the multiline string you're checking - a caption, an expanded wildcard prompt, whatever you want to test. words is a single-line string where you list the word or words you're checking for. The output, is_containing_the_word, is true if any of them show up in text, false otherwise.
Installing it. Search "comfyui_gr85" in ComfyUI Manager, or from a terminal:
cd ComfyUI/custom_nodes
git clone https://github.com/veighnsche/comfyui_gr85
Restart ComfyUI afterward. No models, no extra dependencies - it's a plain string check.
What it's actually good for. Pair it with GR85_Florence2RunCTPG's caption output to branch a workflow based on what Florence-2 saw in the image - route toward a different LoRA or a different negative prompt if the caption mentions "indoor" versus "outdoor," say. Or wire it downstream of GR85_SimpleWildcardPicker to react to which wildcard option got picked, without hardcoding the seed logic yourself. It's a small node, but it's the kind of small node that turns a linear pipeline into one with actual conditional logic.
Where to be careful. The schema doesn't expose a case-sensitivity or multi-word-list option, so if you're passing multiple words in words, don't assume you get fine control over "match any" versus "match all," or over punctuation and capitalization edge cases - test it against a couple of real captions with GR85_ShowText wired to the boolean's source text before you trust it in a branch you're not watching closely. If a caption comes back oddly capitalized (some captioning models do sentence case, others don't), that's the first thing to check if a match you expected doesn't fire.
It's also worth remembering this only tells you that a word showed up, not where or how many times - if your branching logic actually needs a count or a position, this node isn't the one doing that job, and you'd need something else downstream to extract more than the boolean. For the common case of "did the model mention X at all," though, that single boolean is usually all a switch node needs to make the call.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| words | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| is_containing_the_word | BOOLEAN | — |