google / google/re2j

Resolve regex groups when performing match opertion in one pass.

Open
#179 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.3k
Forks
165
PR merge metrics
No merged PRs in 30d

Description

By default, RE2J does not resolve all the groups when performing a match operation, rather it only resolves groups when `Matcher.group(*)` is called. This results in input being processed twice. Once during [find()](https://github.com/google/re2j/blob/master/java/com/google/re2j/Matcher.java#L352) and then again during [group(*)](https://github.com/google/re2j/blob/master/java/com/google/re2j/Matcher.java#L285). This increase the latency when `Matcher.find()` and `Matcher.group(*)` are called in succession.

The request here is to allow resolving all the regex groups when `Matcher.find()` is called, such that when `Matcher.group(*)` is called, the groups can be served from cache.

Pull Request and Performance results are here : https://github.com/google/re2j/pull/178

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.