Nodes/comfy-ovum/re.Match.__repr__ (Regex Match View)
ComfyUI Node

re.Match.__repr__ (Regex Match View)

One node to actually see what your regex matched

By sfinktah·Created about a year ago·Updated 10 months ago· 7
re.Match.__repr__ (Regex Match View)
  • match
  • text

Regex nodes are black boxes until they aren't. OvumReMatchView is the one that opens the box: feed it any RE_MATCH object (or a list of them) and it prints out a formatted, human-readable description of everything - the pattern, the flags, the span, the whole matched text, the groups tuple, and the named-groups dict - on both the node's text output and its canvas status. When a pattern is matching "wrong," this is the node you attach to find out how it matched, in about ten seconds.

How it works

Give it a match input (single object or list) and it builds a compact per-match line:

[0] pattern='(.+?)_(\d{5})\.png' flags=34 span=(0, 13) group0='batch_00042.png' groups=('batch', '00042') groupdict={}

Every element of the match object, laid out so you can cross-check your assumptions: which pattern actually compiled (catches stale-pattern bugs), what flags were in effect (that default IGNORECASE again), where the match landed, the full text, and the captured groups. None matches are reported as [i] None, so a mixed batch is still legible. The output text is a single STRING (not list-shaped), and the same content shows in the node's status/UI text.

Why you'd reach for it

This is the debugging node of the regex family, full stop. Before you build an elaborate finditer → group → span pipeline, wire a View on the raw match output and confirm the match actually has the structure you think it does. It's also a great teaching tool - if you're porting a Python regex into ComfyUI for the first time, the View output is essentially the repr() of what your pattern produces, so you can verify the port before committing to the rest of the graph.

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 models; light pure-Python deps installed by Manager.

The gotcha

It's for reading, not routing. The text output is a debug string - don't build your pipeline on top of it. And it shows the state of the match as the pack's nodes constructed it; if you fed it a match from a different node set, behavior can differ. Leave it in your graph permanently if you want - it's harmless and keeps every regex result visible - but the natural workflow is View to understand, then delete it and wire the real extractors.

Categoryovum/regex

Inputs (1)

NameTypeDefaultDescription
matchRE_MATCHThe match object (or list of match objects) to view.

Outputs (1)

NameTypeDescription
textSTRING