[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A bug in string.gmatch and string.gsub?
- From: David Heiko Kolf <david@...>
- Date: Mon, 29 Apr 2013 20:57:23 +0200
Am 29.04.2013 20:20, schrieb Mark Gabby:
> Why does this behave in this way? I would expect the result to be:
>
> ITEM;ITEMITEMITEM;ITEM 5
>
> > > Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> > > > =(";a;"):gsub("a-", "ITEM")
> > > ITEM;ITEMaITEM;ITEM 4
> > >
> > > Why is that 'a' still there?
"a-" matches the shortest string possible so that the rest of the
pattern still matches. An "a-" at the end of the pattern always matches
exactly 0 characters.
Best regards,
David Kolf