Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to RE2::MatchData via RE2::Scanner #54

Closed
lupine opened this issue Sep 3, 2021 · 2 comments
Closed

Access to RE2::MatchData via RE2::Scanner #54

lupine opened this issue Sep 3, 2021 · 2 comments
Labels
stale Issues that haven't had any activity for at least 60 days

Comments

@lupine
Copy link

lupine commented Sep 3, 2021

Hi,

Today I had occasion to try to replace a usage of the Ruby Regexp class like:

"foo".scan(/(.)/) {|match| ... }

with an RE2 regular expression.

I quickly ran up against the fact that RE2::Scanner#scan returns Array<String> rather than Array<RE2::MatchData>.

In my case, I want access to the begin and end metadata that the RE2::MatchData would carry.

Is this something you'd accept a PR for?

It's possible I'll be able to use ReplaceAll instead, in this particular case, or work around it another way, so I can't guarantee I'll put one together, but I wanted to assess the likelihood of it being accepted early :)

@mudge
Copy link
Owner

mudge commented Sep 3, 2021

Hi @lupine,

I’d be happy to review a PR for that but we’d need to introduce a new API for it to avoid breaking compatibility. Perhaps another method on Scanner or a separate class altogether?

@mudge
Copy link
Owner

mudge commented Nov 20, 2022

As there's been no activity on this issue for over a year, I'll close it in a week unless there's an update.

@mudge mudge added the stale Issues that haven't had any activity for at least 60 days label Nov 20, 2022
@mudge mudge closed this as completed Dec 2, 2022
@mudge mudge closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues that haven't had any activity for at least 60 days
Projects
None yet
Development

No branches or pull requests

2 participants