posix – Why does this regex with a lazy quantifier match exactly 2 digits?

The regex is: ([0-9]+?)*.

The command line is: echo 12345678 | grep -E -o '([0-9]+?)*', and the output is:

12
34
56
78

where as I expect a single line: 12345678, since the outter-most quantifier is a greedy one.

The grep in question conforms to 2024 edition of the POSIX standard, the one I use is shipped with macOS 15. Austin Group as a tracked bug that discuss various aspects of existing ambiguities and mis-wordings, but so far we all agree the regex used by standard interfaces should use the shortest match rather than least repetition.

Which begs the question – in what way does the above output conform to the description of the standard or the newly proposed wording?

Read more here: Source link