Geoff Clare wrote, on 24 Sep 2024:
>
> >  |    Consistent with the whole match being the longest of the leftmost
> >  |    matches, each subpattern, from left to right, shall match the
> >  |    longest possible string.

> Thinking some more about that text, I see a problem. Since it
> specifically talks about subpatterns, it could be read as implying
> that subpatterns are maximised at the expense of parts that are not
> in subpatterns.  Modifying the example to matching ".*\(.*\)" against
> "abcdef", this interpretation would mean that the subpattern matches
> the longest possible string, which is "abcdef", with the initial ".*"
> matching nothing.  However, all the implementations I tried give the
> expected null match for the subpattern.

Of course this assumes that "subpattern" is a synonym for "subexpression".
However, there is nothing in the standard to indicate that this is the
case.  In fact, the above text and the example that follows it are the
only places where the word "subpattern" appears in the standard.

If "subpattern" is intended to be interpreted as "individual BRE or ERE
in a set of concatenated BREs or EREs" then all is well, but we should
clarify the standard by avoiding that word.

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

Reply via email to