Two acceptance bugs and three missing diagnostics, all in ECMAScript mode. Every "JavaScriptCore" column below was produced by running the same program under JavaScriptCore (home-tool); node v24.4.1 accepts and rejects the same patterns.
1. An Assertion takes no Quantifier. ECMAScript's Term lets a Quantifier follow an Atom, not an Assertion (22.2.1). Annex B adds exactly one exception, QuantifiableAssertion, which is a lookahead outside u mode. These compiled and matched:
| pattern | zig-regex | JavaScriptCore |
|---|---|---|
/^*/ /^+/ /^?/ /^{2}/ | accepted | Invalid regular expression: nothing to repeat |
/$*/ /\b*/ /\B*/ | accepted | Invalid regular expression: nothing to repeat |
/^*/u /$*/u /\b*/u | accepted | Invalid regular expression: nothing to repeat |
/(?=a)*/, /(?!a)*/ and /(?=a){2}/ stay legal outside u, as Annex B says.
2. (?P<x>a) was parsed as a Python-style named group. After (? ECMAScript allows only :, =, ! and <. JavaScriptCore reports Invalid regular expression: unrecognized character after (? for (?P<x>a), (?P=x) and (?i)a.
3. Three defects reached the embedder as the bare fallback. CompileErrorReason had no variant for them, so an embedder could only print "invalid regular expression":
| pattern | JavaScriptCore |
|---|---|
/(?<=a)*/, /(?<!a)?/ (any mode) | Invalid regular expression: invalid quantifier |
/a{/u, /a{1/u | Invalid regular expression: incomplete {} quantifier for Unicode pattern |
/]/u, /}/u | Invalid regular expression: unmatched ] or } bracket for Unicode pattern |
Fixed in 1d3e5c9. The rejections are ECMAScript-only — other dialects still compile ^* and (?P<x>a) — and the new reasons are invalid_quantifier, incomplete_quantifier_for_unicode_pattern and unmatched_bracket_for_unicode_pattern. A 25-row table test pins each verdict, zig build test-core passes, and the 20,775-case node differential is unchanged (800 refused, the same 308 mismatches, 0 regressed).