Summary
RFC 0006 defines the regex dialect as "the intersection of Python's re module and Rust's
regex crate". Four constructs outside that intersection are accepted:
- A.
\p{Nd} — Unicode property classes (Rust-only; Python re rejects:
bad escape \p at position 0)
- B.
(?<name>...) — Rust's group-name spelling (Python requires (?P<name>...) and
rejects this one: unknown extension ?<n at position 1)
- C.
[[:alpha:]] — POSIX classes (in neither engine's shared subset: Python and Go
both parse it as an ordinary bracket expression that matches "a]" but not "a")
- D.
[a-z--[aeiou]] — Rust's -- set-difference class operator, genuinely
implemented: re_search('a', r'[a-z--[aeiou]]') → null (vowel excluded) while
re_search('b', ...) matches. Python's re parses the same pattern as ordinary ranges
(matching "b]", not "b"), so the same template means different things under the two
readings the spec says must agree.
Versions
openjd-model 0.11.1 and 0.11.2 from PyPI
openjd-rs main at 1a89f3a — all four still reproduce
Reproduction
from openjd.expr import parse_expression
cases = [
r"re_search('3', r'\p{Nd}')", # -> ["3"] (accepted)
r"re_search('ab', r'(?<n>a)b')", # -> ["ab", "a"] (accepted)
r"re_search('a', r'[[:alpha:]]')", # -> ["a"] (accepted, POSIX reading)
r"re_search('a', r'[a-z--[aeiou]]')", # -> null (set difference applied)
r"re_search('b', r'[a-z--[aeiou]]')", # -> ["b"] (set difference applied)
]
for src in cases:
r = parse_expression(src).evaluate_with_metrics()
print(src, "->", str(r.value))
Each construct was checked against real Python re directly (rejection messages above), not
just against the spec text.
Why this matters
A template written against this implementation can use patterns a spec-conformant
implementation must reject — and for -- and [[:alpha:]], patterns that silently match
differently in engines that treat them as ordinary bracket expressions.
Summary
RFC 0006 defines the regex dialect as "the intersection of Python's
remodule and Rust'sregexcrate". Four constructs outside that intersection are accepted:\p{Nd}— Unicode property classes (Rust-only; Pythonrerejects:bad escape \p at position 0)(?<name>...)— Rust's group-name spelling (Python requires(?P<name>...)andrejects this one:
unknown extension ?<n at position 1)[[:alpha:]]— POSIX classes (in neither engine's shared subset: Python and Goboth parse it as an ordinary bracket expression that matches
"a]"but not"a")[a-z--[aeiou]]— Rust's--set-difference class operator, genuinelyimplemented:
re_search('a', r'[a-z--[aeiou]]')→null(vowel excluded) whilere_search('b', ...)matches. Python'sreparses the same pattern as ordinary ranges(matching
"b]", not"b"), so the same template means different things under the tworeadings the spec says must agree.
Versions
openjd-model0.11.1 and 0.11.2 from PyPIopenjd-rsmainat1a89f3a— all four still reproduceReproduction
Each construct was checked against real Python
redirectly (rejection messages above), notjust against the spec text.
Why this matters
A template written against this implementation can use patterns a spec-conformant
implementation must reject — and for
--and[[:alpha:]], patterns that silently matchdifferently in engines that treat them as ordinary bracket expressions.