lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Yea, I'd agree that 4 is a bug. * is supposed to be greedy.

On Apr 29, 2013 9:04 AM, "Peter Hickman" <> wrote:
The reading of "a*" is to match zero or more 'a's

1) There are zero 'a's before the first ';' so print ITEM
2) The ';' is not an 'a' so just print ;
3) The 'a' matches 'a*' and so we print ITEM
4) After the last match, but before the second ';' there are zero 'a's so we print ITEM
5) The ';' is not an 'a' so just print ;
6) After the last ';' but before the end of the string there are zero 'a's so print ITEM

The only oddity for me is step 4 if my understanding of how this works is correct.

Of course without step 4 you would have what you wanted. To be honest I am mystified by step 4, it looks like a bug to me