Niu Danny wrote, on 06 Mar 2025:
>
> > 发件人: mikehaertel <[email protected]>
> >
> > MinRX currently matches the specific (aaa??)* example in the
> > proposed new wording, but does so for reasons that I think are
> > accidental I personally think the most desirable behaviour for
> > (aaa?)* against "aaaaa" would be for the first instance of the
> > parenthesized subexpression to match aa (because that's minimal),
> > but then the second instance should match aaa, because that
> > results in the longest match for the outer enclosing *, and aaa
> > is certainly a legal match to aaa??

It seems to me that Mike is trying to retroactively move the goalposts
here.  When we decided to add REG_MINIMAL and the '?' modifier it was
our intention to specify the longstanding macOS behaviour (or the
intended behaviour for cases where we believed it was buggy), and the
macOS re_format man page specifically documents the behaviour of
(aaa??)* as not following the historical overall-longest-match rule.

> > Throughout POSIX regular expressions there has been a theme that
> > optimizing the overall match of outermost-enclosing constructs
> > takes precedence over optimizing the matches for inner enclosed
> > subpatterns, and I think Geoff Clare's proposed new wording violates
> > the principle of least surprise in that regard

I accept this behaviour may be surprising to users who are used to
the historical overall-longest-match rule, but it's how macOS has
behaved for a long time.  The priority in POSIX development is to
standardise existing practice.

-- 
Geoff Clare <[email protected]>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England

  • Fwd: [mikehaertel/minrx] ... Niu Danny via austin-group-l at The Open Group
    • Re: Fwd: [mikehaerte... Geoff Clare via austin-group-l at The Open Group

Reply via email to