[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Baffling behaviour of string.match
- From: Peter Cawley <lua@...>
- Date: Tue, 14 Dec 2010 17:32:40 +0000
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 "".