re.findall (Regex FindAll)
Pull every match out of a string as plain text — great for tags, numbers, and filenames
- flags
- results
re.findall is the extraction node: give it a pattern and it returns every non-overlapping match in the string, left to right, as plain strings - no match objects to unwrap. OvumReFindAll is the ComfyUI port, and it's the one you grab when you want to harvest things out of a block of text: all the numbers in a settings dump, every tag in a comma-separated prompt, each filename line in a VHS frame list, all the hex codes in a color palette. It returns strings, which means you can wire the result straight into a list or batch consumer without an extra unwrapping step.
How it works
You give it pattern and string; it compiles with the incoming flags (RE_FLAGS, default IGNORECASE on) and returns a list of all matches. Two behaviors worth knowing, straight from Python semantics:
- No groups in the pattern → you get a list of full-match strings.
- One or more capturing groups → you get a list of the group contents instead (tuples if multiple groups). That's the classic shortcut: extract just the digits from
v2_1234withr'v2_(\d+)'and you get["1234"], not the wholev2_1234.
Inputs:
pattern- multiline field for the regex.string- text to scan.string_in- optional link, overrides the widget, and accepts a list of strings. For each input string you get its own list of matches, all returned through the singleresultsoutput (which is list-shaped).flags- from the re.compile flags node.
The results output is a list of strings. That's the whole loop: no None entries, no empty-list crashes - no matches just means an empty list, which downstream nodes handle fine.
Why you'd reach for it
Any time a string has a repeating structure you want to turn into a collection. Extract every {tag} from a wildcard-style prompt, pull all numbers from an image-info blob, collect every path line out of a multi-line file list. It's also the simplest way to count occurrences: the length of the output list is your count.
Installing it
Ships in comfy-ovum. ComfyUI Manager → search "comfy-ovum", or:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
Restart, find it under ovum/regex. No model downloads; dependencies are light pure-Python (Manager installs them; manual: pip install -r requirements.txt).
The gotcha
The groups behavior surprises people. If your pattern has a capturing group and the results look "too short," that's why - findall returns the captured groups, not the full matches. Want full matches and groups? That's what the pack's re.finditer + re.Match.group combo is for, at the cost of an extra node. For quick text-to-list extraction, findall is the least ceremony you'll get in a graph.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| pattern | STRING | The regular expression pattern. | |
| string | STRING | The string to search. Used if `string_in` is not connected. | |
| string_inopt | STRING | Input string or list of strings. Overrides `string` widget if connected. | |
| flagsopt | RE_FLAGS | 2 | Regex compilation flags. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| results | STRING | — |