Skip to content

Support non capturing regex groups - #76

Merged
noha merged 3 commits into
masterfrom
support-non-capturing-regex-groups
Aug 1, 2026
Merged

Support non capturing regex groups#76
noha merged 3 commits into
masterfrom
support-non-capturing-regex-groups

Conversation

@noha

@noha noha commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

noha and others added 3 commits August 1, 2026 12:18
…rties

Pharo's Regex engine raises 'Invalid lookaround expression ?:' on (?:...)
non-capturing groups, which are common in real-world schemas (e.g. the
official OAI OpenAPI 3.0 meta-schema's Responses pattern
'^[1-5](?:\d{2}|XX)$') - any document validation that reached such a
pattern crashed outright instead of returning valid/invalid.

Added String>>asECMARegex, which rewrites (?: to ( before compiling.
Semantically equivalent for the boolean match/no-match checks that
pattern and patternProperties need; both call sites now use it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Found while writing broader OpenAPI document-validator test coverage:
the OAI meta-schema's component-name patternProperties keys use
[a-zA-Z0-9\.\-_]+ (components.schemas/responses/parameters/etc, i.e.
almost every object in the spec) - Pharo's Regex engine raised 'bad
backslash escape' on the escaped dot inside the class, same root cause
as the non-capturing-group issue in the previous commit.

\. and . are equivalent inside a character class in every regex
dialect, so asECMARegex now also strips the backslash there (tracking
class-nesting so it only touches escapes actually inside [...]).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…slash)

The three new regex-regression tests embed a JSON string containing a
literal backslash (the regex escape char). JSON itself requires that
backslash to be escaped as \\ - I'd mirrored these from the working
image with single backslashes instead, which is invalid JSON and
raised NeoJSONParseError on a fresh load. Verified the corrected
literals byte-for-byte via a real JSON parser before committing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@noha
noha merged commit 29c9e13 into master Aug 1, 2026
3 of 4 checks passed
@noha
noha deleted the support-non-capturing-regex-groups branch August 1, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant