You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The regex API currently allocates RzPVectors and RzRegexMatch. This is of course not optional. Because we could save the allocations. PCRE2 itself doesn't allocate its matches.
Describe the solution you'd like
Instead we should add an implementation which returns an RzIterator.
The RzIterator->next could just do the pcre2_match(), increment the offset into the buffer and return the RzRegexMatch object over the stack.
In the end RzRegexMatch is rather small.
One problem is grouping of multiple matches per buffer. Implementing match_all requires an additional index. To indicate where each RzRegexMatch belongs to.
Regex: "(Te(x)t)"
Possible groups: 0: (Text) 1: (x)
Match all on: "TextTextText"
Gives:
[
{0: Text, 1: x},
{0: Text, 1: x},
{0: Text, 1: x},
]
For our match_all implementation with RzIterators, we somehow have to get the indices for each {0: Text, 1: x}.
Describe alternatives you've considered
None
Additional context
...
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The regex API currently allocates
RzPVectors
andRzRegexMatch
. This is of course not optional. Because we could save the allocations. PCRE2 itself doesn't allocate its matches.Describe the solution you'd like
Instead we should add an implementation which returns an
RzIterator
.The
RzIterator->next
could just do thepcre2_match()
, increment the offset into the buffer and return theRzRegexMatch
object over the stack.In the end
RzRegexMatch
is rather small.One problem is grouping of multiple matches per buffer. Implementing
match_all
requires an additional index. To indicate where eachRzRegexMatch
belongs to.For our
match_all
implementation withRzIterators
, we somehow have to get the indices for each{0: Text, 1: x}
.Describe alternatives you've considered
None
Additional context
...
The text was updated successfully, but these errors were encountered: