ComfyUI Node

Regex Find All

Regex Find All — grab every match, not just the first

By SeanScripts·Created 2 years ago·Updated 2 years ago· 79
Regex Find All
    • STRING
    pattern
    string
    flagsM

    Regex Find All finds every occurrence of a pattern in a string and returns them as a list. Where this pack's Regex Search stops at the first match, this one keeps going - which makes it the node you reach for when the text is full of things you want to collect: all the numbers, all the tags, all the URLs, all the coordinates.

    Inputs: pattern, string, and flags (default "M" - the pack's letter-based flags: a/i/l/m/s/u/x, matching Python's regex flags). Output is a single STRING - but read the fine print: it's a list of matches, which plugs into anything that accepts string lists, like this pack's Join String.

    The one thing that catches people

    If your pattern has one capture group, the output is a list of just those captured strings - clean and simple. If it has more than one capture group, each element becomes a tuple of the groups for that match. Same for zero groups: you get the full matched text back. So (\d+) gives you a flat list of numbers, but (\d+)-(\d+) gives you pairs. Check the groups in your pattern before you assume the output shape.

    How it works

    Under the hood it's re.findall, the classic Python "return everything" function. The flag letters get translated to Python's real flags (m = multiline, i = ignore-case, s lets . match newlines, etc.). It returns an empty list when nothing matches - no error, just nothing.

    Where it fits

    A natural pair with the pack's vision models: a caption might contain multiple bounding-box coordinates or repeated labels, and Find All collects every instance for downstream nodes. It's also just generally useful for cleaning up model output that loves lists.

    Install

    Ships with the SeanScripts pack - Manager search ComfyUI-PixtralLlamaVision, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SeanScripts/ComfyUI-PixtralLlamaMolmoVision
    

    Restart after installing. No extra dependencies.

    Troubleshooting

    • Output is tuples, not strings - your pattern has multiple capture groups. Use one group, or expect tuples.
    • Empty result - no matches, or the pattern is broken. Test the pattern first.
    • Matches too much / too little - greedy .* matches as much as possible; use .*? for lazy matching if needed.

    Regex isn't anyone's favorite thing, but this node turns it into a one-input-one-output list generator - the kind of utility that quietly unblocks a whole workflow.

    CategoryPixtralLlamaVision/Utility

    Inputs (3)

    NameTypeDefaultDescription
    patternSTRING
    stringSTRING
    flagsSTRINGM

    Outputs (1)

    NameTypeDescription
    STRINGSTRING