ComfyUI Node Runs on cloud

Text Contains

Does this string hold that substring?

By WASasquatch·Created 3 years ago·Updated 2 days ago· 1,839
Text Contains
    • BOOLEAN
    text
    sub_text
    case_insensitivetrue

    Simple job: check whether a substring shows up inside another string, with case-insensitivity as an option. It's the boolean building block behind conditional logic in a text-driven graph - you're not going to reach for it to do anything to text, you're going to reach for it to decide whether something else should happen.

    Where it fits in a workflow

    WAS Node Suite has a whole family of Input Switch nodes - CLIP, Model, VAE, Image, Latent, Lora, Conditioning, ControlNet - every one of them picking between two inputs based on a boolean. Text Contains is one of the more useful ways to generate that boolean in the first place, rather than typing true/false by hand. A common pattern: your prompt gets built dynamically (say, via WAS's CLIPTextEncode (NSP) with wildcards), and you want a LoRA to switch on automatically whenever a certain trigger word ends up in the final text. Wire your assembled prompt into Text Contains, check for the trigger word, and feed the boolean into a Lora Input Switch. No manual toggling required.

    It's equally useful for validation and gating: making sure a loaded text file or a piece of user input contains something expected before the rest of the graph runs on it, combined with WAS's Logic nodes (AND/OR/NOT) if you need to combine more than one condition.

    How it works

    You give it the string to search (the haystack) and the substring to look for (the needle); the case-insensitive option, when on, means "Cat" and "cat" count as the same match. The output is a single boolean - true if found, false if not - and nothing else. It's a literal substring search, not a regex or fuzzy match: "cat" will match inside "category" just as happily as inside "cat photo," so if you need a whole-word match specifically, this node alone won't guarantee it.

    Installing it

    Part of the full WAS Node Suite pack:

    • ComfyUI Manager - search WAS Node Suite, install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui/, then pip install -r requirements.txt from inside that folder, then restart ComfyUI.

    Common issues

    The main trap with this node isn't a bug, it's the literal-substring behavior catching people off guard - if your condition unexpectedly fires (or doesn't), check whether your "needle" is a substring of some other word you didn't intend to match. There's no whole-word boundary option here, so a short or common needle string is more likely to produce false positives.

    Beyond that, it's the same pack-wide situation as every other WAS node: the suite has been unmaintained since December 2023, and "Import Failed" errors after a ComfyUI update are a real, recurring complaint tied to the pack's older pinned dependencies. Reinstalling requirements.txt inside your ComfyUI venv is the usual fix if the whole pack won't load.

    CategoryWAS Suite/Logic/Boolean

    Inputs (3)

    NameTypeDefaultDescription
    textSTRINGThe text to search through, such as a prompt or a file name, as `a tabby cat`.
    sub_textSTRINGThe word or phrase to look for. It has to appear as written, spaces included, and it can sit anywhere in the text rather than only at the start. Left empty, it matches everything.
    case_insensitiveoptBOOLEANtrueWhether capitals are ignored. On, 'Cat' finds 'cat'; off, only an exact match of upper and lower case counts.

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEANTrue when the phrase was found somewhere in the text.