access `regex::Match` or `Captures` struct impl results (e.g. range, start, end, etc)
- Dominant language
- Rust
- Stars
- 3.6k
- Forks
- 1.3k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 167
Description
**What are you trying to do?**
I would like to extract `regex::Captures` structs directly, rather than the already-unwrapped string values, because I require the byte offsets directly (e.g. to implement [ISO 24612](https://www.iso.org/standard/37326.html), which requires primacy of string span locations in a document, not the contents themselves).
**Describe the solution you'd like**
Either a new function to extract the [`Captures`](https://docs.rs/regex/latest/regex/struct.Captures.html) structs directly, or a mode for `compute::regexp_match` that provides the offset anchors for each match.
**Describe alternatives you've considered**
Retrieving the strings and then trying to find their locations one-by-one is wasteful of resources, and I can't find a flag to enable the desired behavior :)
**Additional context**
Coming here from [polars#16341](https://github.com/pola-rs/polars/issues/16341), but if I'm understanding their codebase correctly, they are using this backend as an intermediary to the `regex` rust lib.
Contributor guide
Research direction
Start with the compute::regexp_match entry point and the regex::Match and regex::Captures APIs referenced in the issue. Determine which API shape should expose byte offsets for each match, then verify that callers can obtain span locations directly without searching the extracted strings again.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100