Nodes/ComfyUI_StringOps/删除标签内的内容🐠meeeyo.com
ComfyUI Node

删除标签内的内容🐠meeeyo.com

Strip everything between two characters — parens, brackets, tags, gone

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
删除标签内的内容🐠meeeyo.com
    • STRING
    input_text
    chars(|)

    If you've ever pasted a prompt that came wrapped in markers - (red dress), (smiling), [best quality] - you know the drill: strip the annotations, keep the words. RemoveContentBetweenChars is the node for that exact job. Give it your text and a pair of characters, and it deletes everything from the first character to the second, inclusive, wherever that pair appears.

    The Chinese display name (删除标签内的内容, "delete content inside tags") frames it as tag-removal, and that's the sweet spot: cleaning parenthesized weights, bracket groups, or HTML-style tags out of text before you feed it somewhere that shouldn't see them.

    It's part of ComfyUI_StringOps, the small Chinese-market utility pack. Like every node in it, the UI gives you a promo line instead of documentation, so the details below come from the actual source.

    How it works

    Two inputs:

    • input_text - the multiline string you're cleaning.
    • chars - three characters with | in the middle, default (|). The first char is the opener, the last is the closer.

    The format is a bit odd but it's how the node lets you type both markers in one field. (|) means "delete from ( to )." Swap in [|] for square brackets, {|} for curly, <|> for angle brackets.

    Under the hood it builds a non-greedy regex - \(.*?\) - and replaces every match with nothing. The non-greedy part matters: given (a) and (b), it removes (a) and (b) separately rather than eating everything from the first ( to the last ). Nested pairs, though, will defeat it, since .*? stops at the first closer. One pass, all occurrences, gone.

    Where it fits

    Prompt cleanup is the obvious case - strip (word:1.3) style weighting when you're reusing a prompt somewhere that treats parens literally. It's also handy for pulling clean text out of scraped content wrapped in tags. And because the removal is inclusive, it deletes the markers too, not just what's between them - you end up with red dress, smiling instead of red dress, smiling with stray parens.

    Output is a single STRING with the cleaned text.

    The catch

    If chars isn't exactly the three-character X|Y format, the node quietly returns your text unchanged - no error, just nothing happened. That silent no-op is easy to miss when you typo the format. And since it matches per line rather than across the whole blob, a pair split across two lines won't be removed.

    Installing it

    The pack standard: ComfyUI Manager → ComfyUI_StringOps → install → restart, or

    cd ComfyUI/custom_nodes
    git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
    

    Nothing to download beyond the pack; it's pure Python string handling with no extra dependencies.

    The honest take

    It's a one-trick node, but it's a good trick and it's faster than hand-editing. If your main need is stripping one marker style from prompts, this beats chaining several SimpleTextReplacer nodes - though for more than one pair type you'll still want to chain two of these or reach for a regex node from a bigger pack. And if you want to keep the content and drop only the markers, this is the wrong tool; that's SimpleTextReplacer's job.

    CategoryMeeeyo/String

    Inputs (2)

    NameTypeDefaultDescription
    input_textSTRING
    charsSTRING(|)

    Outputs (1)

    NameTypeDescription
    STRINGSTRING