-
Notifications
You must be signed in to change notification settings - Fork 42
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
Registers in repetitions are not returned #25
Comments
It looks like Python has the same behavior:
==> Is there an example where you get different & unexpected behavior using Python or some other regex as a co-witness? |
Also using
which matches
==> |
As an aside, if you're trying to match the variable bindings, what's hurting your regex is greediness. If you use non-greedy +:
==> |
Well, my reference point was The canonical way in
But there's no Anyway --
Without the
I think perl's behaviour was different back in 2015 - I would've remembered if I had encountered this unexpected greedy vs. non-greedy difference. A looping construct works:
|
Using 35c5266, I can see that registers within repetitions are not correctly returned:
I would have expected either an array with 4 strings, or an array with two arrays (or lists) in it.
SCAN
,REGEX-REPLACE
,REGEX-REPLACE-ALL
are all messed up by that, too, of course.BTW, how is
REGEX-REPLACE-ALL
supposed to be used with repetitions? When having a pattern^A(B)*$
, the replacement lambda only gets called once (and has to return the complete new string), so it doesn't really provide any advantage over usingSCAN
.So, in order to be able to return new strings for each of the B matches (individually) I have to match the
A
first, and then call again with:START
for theB
s; there's no easier way, right?The text was updated successfully, but these errors were encountered: