re.compile flags (Regex Flags)
The Regex Flags node is the one setting every Ovum regex node shares — here's what each toggle actually does
- flags
If you've dropped any of the regex nodes from the comfy-ovum pack and stared at the flags input wondering where a RE_FLAGS value comes from, this is the answer. OvumReFlags ("re.compile flags") is the little builder that turns checkboxes into the integer flag set every other node in the ovum/regex family consumes. You don't strictly need it - the matchers default flags to re.IGNORECASE and will run fine with nothing wired in - but the moment your pattern needs MULTILINE or DOTALL, this is how you say so without leaving the graph.
How it works
Under the hood it does exactly what re.compile(pattern, flags) would: it starts with 0 and bitwise-ORs in each Python re flag whose checkbox is on. Eight toggles, each matching a real re module constant:
- IGNORECASE - default on.
[a-z]-style matching ignores case. Note this differs from raw Python, where the default is case-sensitive; if your matches come back unexpectedly loose, this is why. - MULTILINE - makes
^and$match at line starts/ends, not just the whole string. - DOTALL -
.matches newlines too. The one people most often reach for when parsing multi-line text. - VERBOSE - lets you sprinkle whitespace and
#comments through the pattern for readability. - ASCII - restricts
\w,\b,\sand friends to ASCII-only matching. - LOCALE - locale-dependent matching. The tooltip literally says "(discouraged)", and it is; leave it off.
- UNICODE - the default behavior for those classes in Python 3; on by default in spirit, exposed here as a toggle.
- DEBUG - dumps the compiler's trace to your ComfyUI console. Great for one debugging session, noisy as a permanent fixture.
The one output that matters
The single flags output is the RE_FLAGS value. Wire it into any matcher node's flags socket - search, match, fullmatch, findall, finditer, split, sub, subn all accept it - and you've configured the whole family. Because it's an int under the hood, you can also feed a plain integer in from elsewhere if you prefer, but the checkbox builder is the readable way to do it. A classic pattern: one OvumReFlags with IGNORECASE + MULTILINE, feeding three different matchers that parse the same block of text.
Installing it
OvumReFlags ships in comfy-ovum, sfinktah's utility grab-bag. In ComfyUI Manager, search "comfy-ovum" and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
Restart ComfyUI and it appears under ovum/regex. No model downloads, nothing heavy - the pack's requirements are small pure-Python packages that Manager installs for you (manual installs: pip install -r requirements.txt).
Gotchas
The big one is that IGNORECASE defaults to on, which trips people coming from Python where it's off. If you copy a pattern that works in a re script and get weird over-matches, check that this node (or the matcher's own default) isn't silently ignoring case. And don't leave DEBUG on after you're done - it prints a compiled-pattern trace to the console on every run.
This node is the least glamorous in the family, but it's the difference between regex that works and regex that "mostly works." Wire one up next to your first re.search node and you'll understand the whole pack's design in one glance.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| IGNORECASE | BOOLEAN | true | Perform case-insensitive matching. |
| MULTILINE | BOOLEAN | false | Make `^` and `$` match at the beginning and end of each line. |
| DOTALL | BOOLEAN | false | Make `.` match any character, including a newline. |
| VERBOSE | BOOLEAN | false | Allow whitespace and comments in the pattern. |
| ASCII | BOOLEAN | false | Make `\w`, `\W`, `\b`, `\B`, `\s`, `\S` perform ASCII-only matching. |
| LOCALE | BOOLEAN | false | Make `\w`, `\W`, `\b`, `\B`, `\s`, `\S`, `\d`, `\D` dependent on the current locale. (discouraged) |
| UNICODE | BOOLEAN | false | Make `\w`, `\W`, `\b`, `\B`, `\s`, `\S`, `\d`, `\D` dependent on the Unicode character properties database. |
| DEBUG | BOOLEAN | false | Display debug information about compiled expression. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| flags | RE_FLAGS | — |