lua-users home
lua-l archive

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


On Mon, Apr 29, 2013 at 11:55 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> With this distinction available, the question reduces to:
> should "a*" return [2,3) or [2,3]?
>
> Adam made a good point here: a greedy quantifier should make
> the longest possible match. One could generalize that as follows:
>
> 1. A zero-length match always includes its endpoint.
> 2. A greedy quantifier always includes its endpoint.
> 3. A non-greedy quantifier does not include its endpoint, except when
>    the match is empty.
>

Thanks. This was actually my intent in bringing it up, but you've done
an excellent job of formalizing it.

/s/ Adam