Looks good to me. I hope we can add this to 
Bug 1857's accepted texts' informative part.

Thank you very much, Geoff and everyone!

> 2025年3月13日 20:39,Geoff Clare via austin-group-l at The Open Group 
> <austin-group-l@opengroup.org> 写道:
> 
> Niu Danny wrote, on 12 Mar 2025:
>> 
>>> I was thinking about something like this:
>>> 
>>> The precedence of quantifiers are as follow (from highest to lowest):
>>> 
>>> 1. The length of any minimal quantifier -modified subexpression
>>>   shall be such that they match the shortest substring of the
>>>   subject string, in descending priority from left to right.
>>> 
>>> 2. Consistent with rule 1, the length of the overall match shall 
>>>   be the longest possible.
>>> 
>>> 3. The length of any greedy quantifier -modified subexpression
>>>   shall be such that they match the longest substring of the
>>>   subject string, in descending priority from left to right.
> 
> That seems like a sound idea for some clarifying text, but it does not
> use the right terminology, it needs to apply to all repetitions not
> just those for subexpressions, and it needs an addition to make the
> pathological cases unspecified.
> 
> Here's my attempt:
> 
> If an ERE contains repetitions with and without the repetition
> modifier '?', the precedence between the repetitions shall be:
> 
> 1. Each leftmost shortest match shall match the leftmost shortest 
> sequence in the string, in descending priority from left to right.
> 
> 2. Consistent with rule 1, the length matched by the entire regular
> expression shall be the leftmost longest.
> 
> 3. Consistent with rules 1 and 2, each leftmost longest match shall
> match the leftmost longest sequence in the string, in descending
> priority from left to right.
> 
> 4. If an attempt is made to match the same sequence of the string
> using repetitions both with and without the repetition modifier '?',
> the behavior is unspecified. For example, the ERE ([0-9]+)+? has
> unspecified behavior.
> 
> -- 
> Geoff Clare <g.cl...@opengroup.org>
> The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
> 


  • I still find the res... Niu Danny via austin-group-l at The Open Group
    • Re: I still fin... Niu Danny via austin-group-l at The Open Group
      • Re: I still... Geoff Clare via austin-group-l at The Open Group
        • Re: I s... Niu Danny via austin-group-l at The Open Group
    • Re: I still fin... Geoff Clare via austin-group-l at The Open Group
      • Re: I still... Niu Danny via austin-group-l at The Open Group
        • Re: I s... Geoff Clare via austin-group-l at The Open Group
          • Re:... Niu Danny via austin-group-l at The Open Group
            • ... Steffen Nurpmeso via austin-group-l at The Open Group
            • ... Geoff Clare via austin-group-l at The Open Group
              • ... Niu Danny via austin-group-l at The Open Group
                • ... Niu Danny via austin-group-l at The Open Group
                • ... Geoff Clare via austin-group-l at The Open Group

Reply via email to