Nodes/Comfyui_PDuse/PD_del_word
ComfyUI Node

PD_del_word

Delete a keyword from your prompt text

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD_del_word
    • result_string
    input_string
    keyword

    PD_del_word (PD_del_word) removes every occurrence of a keyword from a string. Input a block of text and a keyword, get the text back with all instances of that keyword gone. It's a one-trick node, but the trick is one you keep needing: scrub a banned tag out of a caption, strip a stray word from a pasted prompt, clean trigger words off a text dump before feeding it somewhere it doesn't belong.

    How it works

    Plain string replacement under the hood - find the keyword and delete it everywhere it appears. No regex, no fuzzy matching, no case-folding magic. That means it's exact and predictable, which is exactly what you want from a text cleaner, but it also means you're at the mercy of literal matching: dog won't touch doggy or Dog unless you type them as the keyword.

    Inputs and output

    • input_string - the text to clean (multiline, wireable).
    • keyword - the exact string to delete everywhere it appears.

    Output is a single result_string. That's the whole interface - no options for case sensitivity or replace-with. If you need find-and-replace with a substitution, that's the pack's JSON caption editor or a general text-replace node; this one only deletes.

    Installing

    Part of the 7BEII/Comfyui_PDuse pack. ComfyUI Manager → search "Comfyui_PDuse" → install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/7BEII/Comfyui_PDuse
    cd Comfyui_PDuse
    pip install -r requirements.txt
    

    Restart after. No models, no extra dependencies.

    Gotchas

    The keyword match is literal and case-sensitive, and deletion is global - every occurrence goes, not just the first. If your keyword is a substring of a word you want to keep (art inside artist), you'll delete more than intended; include surrounding spaces or punctuation in the keyword to pin it down. And deleting leaves the surrounding whitespace behind, so a removed mid-sentence keyword can leave a double space - cosmetic, but it'll show up in your prompt. If that bothers you, the pack's PD_empty_word (whitespace collapser) is a natural companion in the same text-cleanup chain.

    CategoryPDuse/Text

    Inputs (2)

    NameTypeDefaultDescription
    input_stringSTRING
    keywordSTRING

    Outputs (1)

    NameTypeDescription
    result_stringSTRING