lua-users home
lua-l archive

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


On Tue, Dec 14, 2010 at 5:31 PM, Dirk Laurie <dpl@sun.ac.za> wrote:
> I don't understand this.
>
> --[[
>> s='abbcd'; return a:match('b')
> b
>> s='abbcd'; return a:match('bb')
> bb
>> s='abbcd'; return a:match('b*')
>
>>
> --]]
>
> I expected the last match to be also "bb".

The first position which "b*" can match at is the start of the string,
where it matches "". There is a longer match later in the string, but
the first match is "".