Nodes/Basic data handling/find all (LIST)
ComfyUI Node

find all (LIST)

Regex findall when you want the results as one LIST, not fanned out

By StableLlama·Created about a year ago·Updated 4 days ago· 48
find all (LIST)
    • LIST
    string
    pattern

    This is the same regex findall as its data-list sibling, with one deliberate difference in the output: it returns a LIST - a Python list that travels through the graph as a single variable - instead of a ComfyUI data list that fans out into individual items. Which one you want is a real design decision, not a cosmetic one, and it comes down to one question: does your next node need to process each match separately, or do you need the whole collection intact?

    Use the LIST variant when you want to hold all the matches together - sort them, count them, feed the whole collection into something that takes a LIST input, or hand it to this same pack's SET converter when you need deduplication. Use the data-list variant when you want each match to flow into a per-item slot (like a batch of prompts or filenames). Same regex engine, same matches, different plumbing.

    How it works

    Straight re.findall(pattern, string) - every non-overlapping match, in order, no groups, no extras. The one Python behavior worth remembering is the "non-overlapping" part: findall("aaa", "a+") returns ["aaa"], not every possible run. And if nothing matches, you get an empty list, which is a clean outcome rather than an error.

    The difference between the two findall nodes lives entirely in the output type declared by the class. Here that's the LIST type (the pack's own custom type for "Python list as one variable"), with no OUTPUT_IS_LIST flag - so downstream nodes receive one list object, not a series of individual strings.

    Inputs and output

    • string - text to search.
    • pattern - the regex; full Python re syntax.

    Output is a single LIST of matched strings.

    Installing it

    Part of Basic data handling by StableLlama - install the pack once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
    

    Restart, or install via ComfyUI Manager (search "Basic data handling"). Zero dependencies, no models - the pack is pure Python stdlib, so it's the rare install that can't break your environment.

    Gotchas

    • Don't reach for the wrong sibling. "find all (data list)" and "find all (LIST)" are the same function; the difference is whether you get per-item fan-out or one variable. If the receiving node won't accept a LIST, you grabbed the wrong one.
    • Greedy patterns will eat your day. .* matches as much as possible; add anchors or lazy quantifiers.
    • A malformed regex raises re.error as a workflow error - that's the "it broke loudly" mode. A syntactically valid but wrong pattern just returns an empty list, which is the "it broke silently" mode.
    CategoryBasic/STRING/regex

    Inputs (2)

    NameTypeDefaultDescription
    stringSTRING
    patternSTRING

    Outputs (1)

    NameTypeDescription
    LISTLIST