Nodes/comfyui_pilcothink_VisionSLM/Remove Specific Patterns
ComfyUI Node

Remove Specific Patterns

It strips your tags — and lowercases everything else, too

By gpdev-Pilcothink·Created 11 months ago·Updated 3 months ago· 2
Remove Specific Patterns
    • STRING
    text
    exclude_tags

    RemoveSpecificPatterns is a small text-cleanup node from the pilcothink pack, and the first thing you need to know about it is the catch: it lowercases your entire string before it does anything. Give it "Photo of a Red Car" and you get "photo of a red car" back, whether you wanted that or not. For cleaning up auto-generated captions before you feed them somewhere that case doesn't matter, fine. For a prompt you care about preserving - read the whole article before you commit.

    What it does beyond that: you hand it text plus a list of tags, and it deletes those tags wherever they appear as whole words. Think "clean the comma-tag noise out of a danbooru-style caption" or "drop the words that a previous node added."

    How it works

    The logic is honest and simple. After lowercasing, if exclude_tags is empty it just strips surrounding whitespace and returns. Otherwise it splits the tag string on commas or spaces, so "simple, black hair" and "simple black hair" both work, then builds a single regex:

    \b(tag1|tag2|tag3)\b
    

    The \b word boundaries mean it removes the tag only as a standalone word - it won't mangle blackbird when you're removing black. It then collapses any runs of whitespace and trims, so you don't end up with double spaces where the tags used to be.

    The inputs that matter

    • text - the multiline string to clean. Required.
    • exclude_tags - optional, single-line. Comma- or space-separated tags to remove. Empty means "just lowercase and trim."

    One STRING output: the cleaned text.

    Install

    It ships in comfyui_pilcothink_VisionSLM, so installing is installing the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/gpdev-Pilcothink/comfyui_pilcothink_VisionSLM
    

    Restart ComfyUI, or install via ComfyUI Manager by searching for comfyui_pilcothink_VisionSLM. Remember the pack's requirements are heavy (transformers, faiss-cpu, sentence-transformers, opencv and more) - you're paying for the LLM machinery even when you only use the text utilities.

    Gotchas

    Three, and the first one is the one that will cost you:

    1. It lowercases everything. If your downstream node or model cares about capitalization, this will quietly destroy it. There's no toggle for it in the schema - it's baked in.
    2. Whole-word matching only. Tag removal respects word boundaries, so dog won't touch dogs or doggo. That's usually what you want, but it means plurals sneak through. Add the plural explicitly.
    3. It's a fresh pack with zero community mileage. No install history, no issue-traffic signal to learn from. Clone from the official repo only - this ecosystem has a real, documented history of malicious LLM-vision custom nodes, and small packs with no reputation are precisely where you don't want to grab a mirror from.

    If you only need to strip tags and not wreck your casing, honestly look for a regex-based text utility elsewhere first. If lowercase output is acceptable - say, feeding a tag-cleaning stage in a captioning pipeline - this one is compact and does exactly what it says.

    CategoryPilcothink/Text

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    exclude_tagsoptSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING