Skip to content

feat: add RegexpCompiler option for custom regexp engines - #73

Open
satisataka wants to merge 1 commit into
google:mainfrom
satisataka:feat/regexp-compiler
Open

satisataka wants to merge 1 commit into
google:mainfrom
satisataka:feat/regexp-compiler

Conversation

@satisataka

Copy link
Copy Markdown

Allow users to provide a custom regexp compiler via ResolveOptions.RegexpCompiler for PCRE-compatible features like lookahead that Go's regexp package does not support.

The Regexp interface requires only MatchString(string) bool, matching both regexp.Regexp and regexp2/compat.Regexp signatures.

Fixes #72

@google-cla

google-cla Bot commented Apr 28, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Allow users to provide a custom regexp compiler via ResolveOptions.RegexpCompiler
for PCRE-compatible features like lookahead that Go's regexp package does not support.

The Regexp interface requires only MatchString(string) bool, matching both
regexp.Regexp and regexp2/compat.Regexp signatures.

Fixes google#72
@satisataka
satisataka force-pushed the feat/regexp-compiler branch from a76cce9 to 253af7b Compare April 28, 2026 11:52
@karolpiotrowicz

Copy link
Copy Markdown
Contributor

@wolo-lab — routing this to you for a direction call rather than a code review.

This adds ResolveOptions.RegexpCompiler and a small Regexp interface so a caller can substitute a different regular-expression engine, for lookahead and other PCRE features Go's regexp does not support. Issue #72 asks for it.

The scope question is conformance rather than code quality. JSON Schema 2020-12 §6.4 says regular expressions SHOULD be valid per ECMA-262 and asks schema authors to stay inside a restricted token set, specifically so schemas stay portable between implementations. A pluggable engine lets a schema depend on syntax no other validator will accept, so it is a decision about what this library guarantees, not about whether the option is well implemented.

adk-go depends on this module, which is why it is coming to you. Open 134 days. Happy to run a full review once there is a direction.

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.

feat: allow custom regexp engine via RegexpCompiler option

3 participants