String Match
The tag filter that answers 'is this word in my prompt?'
- matched_words
String Match is a quiet little node that answers one question: which of the words I care about actually appear in this text? You hand it a blob of text and a comma-separated list of terms, and it hands back the ones that matched, comma-joined. Nothing more. But in a workflow, "nothing more" turns into caption filtering, trigger-word checks, and routing logic - the boring glue that makes prompt pipelines behave.
How it works
Mechanically it's simple and worth knowing precisely:
- Your
match_wordsare parsed as CSV (the author uses Python's csv reader, so quoted phrases like"high detail"match as a phrase rather than splitting). - Everything is lowercased, then each term is checked as a substring of the input.
- Matches are returned comma-separated in the order you listed them.
The substring detail is the one that bites people. red will match inside predator; art will match cartoon. There's no word-boundary logic. If you need exact tag matching, sort your terms by length or pad them - this node does not do that for you.
The inputs and outputs
- text_input - the text to search (multiline)
- match_words - your comma-separated terms, single line (quoted phrases allowed)
Output: a single matched_words STRING. If nothing matches, you get an empty string, not an error - which is exactly what you want when the empty result is a meaningful state for the next node to branch on.
Where it earns its keep
Say you're doing dataset work - caption files where you need to know which of your concept keywords each caption contains. Or you've got a dynamic prompt and you want to gate a LoRA or a ControlNet on whether the trigger phrase actually survived the wildcard pass. Wire String Match in front of a text switcher or a conditional node, and you've got a cheap classifier that costs zero models and zero API calls.
It pairs naturally with the rest of the DJZ-Nodes text suite (StringWeights, the Zenkai prompt stuff), but it's also happy to sit in any workflow alongside ComfyUI core text nodes - that's the point of a pure-text utility.
Install
It ships in DJZ-Nodes by Drift Johnson. ComfyUI Manager → search "DJZ-Nodes" → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt
Restart ComfyUI. This node itself is dependency-free Python; the pack's heavy requirements (librosa, numba, trimesh, moderngl) are for its other 70+ nodes.
Gotchas
Two, both real. The substring matching is the big one - remember red matches predator. And if either input is empty, the node returns "" immediately, so an empty match_words silently means "nothing ever matches." That's usually what you want, but it's worth a glance when a workflow suddenly stops routing the way you expected.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text_input | STRING | — | |
| match_words | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| matched_words | STRING | — |