Nodes/ComfyUI_KimNodes/🍒Text_Match / 文本匹配
ComfyUI Node

🍒Text_Match / 文本匹配

A substring check that gives you a routing switch

By wjl0313·Created 2 years ago·Updated 12 months ago· 54
🍒Text_Match / 文本匹配
    • 文本
    • 布尔值
    text_match
    text_tag

    Text_Match is the workflow-routing staple: it checks whether one string appears inside another and hands you a boolean you can use to switch branches. Want to run different post-processing depending on whether a loaded prompt mentions "cat"? Need to sort images by whether their filename contains "tile"? This is the gate. It's tiny, it's obvious, and it sits in the same niche as a hundred other "text contains" nodes - but it does the job with zero fuss.

    How it works

    Two wired-in string inputs, one plain check: does text_match appear as a substring of text_tag? That's literally text_match in text_tag under the hood - no regex, no fuzzy matching, no word boundaries. It returns both the Python boolean and the stringified version, so you can wire whichever your downstream node wants. Both inputs are forceInput, meaning you connect them rather than typing, which keeps you honest about where the data comes from.

    The inputs that matter

    • text_match - the needle: the string you're looking for.
    • text_tag - the haystack: the string being searched.

    Two outputs: 文本 (STRING - the string "True" or "False") and 布尔值 (BOOLEAN - an actual boolean). The string output exists because ComfyUI's switches and conditionals sometimes want the text form; if you're feeding a real boolean-aware node, use the bool output.

    Installation

    Ships in ComfyUI_KimNodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/wjl0313/ComfyUI_KimNodes
    

    Restart ComfyUI. Nothing extra.

    Common issues

    Read the README's framing and you'll think this does more than it does. The README describes it as "evaluate whether the content of an image matches a given set of keywords" - but the node itself has no idea about images. It's purely string-in-string matching. If you're feeding it a tag list like cat, dog, bird, searching for cat will always match, because "cat" is a substring of the whole comma-joined string. That's usually fine, but it's also how people get surprised: substring matching doesn't respect word boundaries, so art matches artist. If you need "does the tag list contain this exact tag," you'll want something with token-aware matching instead. Otherwise it's a five-second node that earns its keep the moment your workflow needs a fork in the road.

    Category🍒 Kim-Nodes/🔍Text_Tools | 文本工具

    Inputs (2)

    NameTypeDefaultDescription
    text_matchSTRING
    text_tagSTRING

    Outputs (2)

    NameTypeDescription
    文本STRING
    布尔值BOOLEAN