Geoff Clare via austin-group-l at The Open Group wrote in
<ZvVOBKTDtaLEYW9V@localhost>:
|Steffen Nurpmeso wrote, on 26 Sep 2024:
|> Also, compare for example this snippet of "man perlre"
...
|> with 9.1 (p 179 bottom / 180 top),
...
|*LIGHT*BULB*MOMENT*
All on my side, indeed.
|THIS is the real key to the shortest vs. least repetitions issue.
|
|I'm fairly sure you can only get a different result from longest
|vs. most repetitions (or shortest vs. least repetitions) if you
|can freely choose between alternatives on each repetition.
|
|perl and python (and presumably php) don't have the issue because,
|unlike POSIX, they try the alternatives in order.
|
|My original test case has the [ab]{6} first:
...
|Switching the alternatives round gives the shorter result for both
|greedy and non-greedy:
...
[aaaabbbb vs ([ab]{6}|a)*?b vs (a|[ab]{6})*?b]
...
|This means all of the comparisons between macOS and perl/python/php
|regarding non-greedy matching (with alternatives) are invalid and
|there is no problem specifying the macOS behaviour in POSIX.
Wonderful!
..And hoping the issue gets closed.
And also that tre gets fixed and minrx gains _minimal/_ungreedy
matching, so that there is something usable on non-Apple.
tre seems to have been released as 0.9.0 by Dag-Erling Smørgrav
just a week ago (i must admit i did not update and so
98fd780425..d0e0c99733 was missing here, aka this month), but the
REG_MINIMAL bug is still present.
(I had btw cloned the re-flex that Hans Åberg mentioned, but
looking at it it feels as if i do not want to spend time with it;
yet it seems *it* introduces the word "lazy" for ungreedy, and has
lots of sophistication in the jungle that it is. The git repo was
almost twice as large as my perl.tar_bomb_git i now have since
twelve years, and more than tenth the size of the entire official
lua language repository, the pattern of which', by the way, are
also a very good thing; there exists "+*" as we know it, and "-"
is like "*?", it seems.)
--End of <ZvVOBKTDtaLEYW9V@localhost>
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)