Nodes/ComfyUI-BooleanExpression/Does not Start with
ComfyUI Node

Does not Start with

Filter out the noise before it reaches the graph

By marco-zanella·Created about a year ago·Updated about a year ago· 0
Does not Start with
    • result
    haystack
    needle
    case_insensitivetrue

    Prefixes are how we organize things without realizing it. Model files start with flux1-. LoRAs start with a style name. Prompts start with a tag like (masterpiece:1.2). So "what does this string start with?" is a real question - and its negative, "what does it not start with?", is how you filter.

    Does not Start with is part of ComfyUI-BooleanExpression, Marco Zanella's dependency-free logic pack. It returns true when the first string does not begin with the second, and false when it does. The source is one line: not haystack.startswith(needle). (Yes, the "S" in "Start" is capitalized in the display name - that's straight from the pack's own node registry, not a typo on this page.)

    How it works

    The inputs, same shape as every string node in this pack:

    • haystack - "The string." The text being tested.
    • needle - "The string to search." The prefix that must not be there.
    • case_insensitive - defaults to True.

    Case folding on by default means "FLUX1-dev" not-startswith "flux" is false - the lowercase fold finds the prefix, so the node says "it does start with it, condition not met." That's the behavior you want for filenames and model tags. If prefixes are case-sensitive in your world, flip the toggle.

    Output: a single result boolean, ready for Conditional Branch, the And/Or/Xor/Not group, or any other BOOLEAN input.

    When it's actually the right tool

    The positive version (Starts with) handles "does this model belong to family X" - flux1- vs sd3- vs illustrious-, each routing to a different sampler or CLIP setup. The negative version is for the exclusion:

    • filename doesn't start with preview_ → it's a real output, run the full post chain.
    • LoRA tag doesn't start with style: → apply the style-changing path... or don't, depending on your graph.
    • Prompt doesn't start with a known quality prefix → prepend one.

    It's a small node, and it's honest about being small. Its value is that ComfyUI has no native way to say "unless" - you build it from booleans, and a negated check you can name beats a positive check you have to mentally invert.

    Install

    Easiest via ComfyUI Manager: search ComfyUI-BooleanExpression, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/marco-zanella/ComfyUI-BooleanExpression.git
    

    Restart ComfyUI; it lives under Boolean Expressions → String Comparisons. The pack is pure Python with an empty requirements.txt - nothing to pip-install, no model downloads, and it's on the Comfy Registry so Manager finds it by title. If a downloaded workflow flags this node red, you've usually just not restarted after installing.

    CategoryBoolean Expressions/String Comparisons

    Inputs (3)

    NameTypeDefaultDescription
    haystackSTRINGThe string.
    needleSTRINGThe string to search.
    case_insensitiveBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    resultBOOLEAN