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

re.Match (Regex Match Result)

Introspect any match object — the debugging eyes of the regex suite

By sfinktah·Created about a year ago·Updated 10 months ago· 7
re.Match (Regex Match Result)
  • match
  • string
  • pattern
  • flags
  • lastindex
  • lastgroup

When a regex node isn't behaving, the first question is "what did it actually match?" OvumReMatchInfo is the node that answers that from the inside: feed it any RE_MATCH object and it spills the read-only attributes - the original string that was searched, the compiled pattern, the flags used, and which group was the last one matched. It's the introspection node of the pack, the one you drop into a failing pipeline to see the ground truth instead of guessing.

How it works

Give it a match input (a RE_MATCH object, or a list of them from a batch operation) and it extracts five attributes per match:

  • string - the original text that was searched (the whole thing, not just the matched slice).
  • pattern - the regex pattern as compiled.
  • flags - the integer flag set used for matching.
  • lastindex - the index of the last matched capturing group (or None if no group participated).
  • lastgroup - the name of the last matched group. (The schema types this as INT, but in practice the code hands through m.lastgroup, which is the group's name string, or None for unnamed groups.)

Every output is list-shaped, so a batch of matches yields aligned lists. Where a match is None (no match), the outputs come back empty/None rather than erroring - consistent with the pack's no-crash philosophy.

Why you'd reach for it

Three use cases. One: debugging - wire re.MatchView if you want the whole picture, or this node if you specifically need the pattern/flags that produced a result, which catches the "wrong pattern got compiled" class of bug fast. Two: feature detection - lastgroup tells you whether a named group was the thing that matched, which you can branch on. Three: auditing - confirming flags (like that IGNORECASE you forgot was on) by reading them back off the actual match.

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

This node reports facts about the match - it doesn't extract content. If you're after the text that matched, that's re.Match.group (group 0 = the whole match). And note lastgroup is one of those spots where the schema's type and the code's reality disagree (INT in the schema, name string in practice) - if a node downstream expects an INT and you feed it a string, that mismatch is why. Use MatchInfo for reading, MatchGroup for extracting.

Categoryovum/regex

Inputs (1)

NameTypeDefaultDescription
matchRE_MATCHThe match object (or list of match objects) to get information from.

Outputs (5)

NameTypeDescription
stringSTRING
patternSTRING
flagsINT
lastindexINT
lastgroupINT