[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Possible bug in string.gsub
- From: Axel Kittenberger <axkibe@...>
- Date: Fri, 18 Mar 2011 18:16:24 +0100
> There are empty strings between all 'a's (as well as before the first
> and after the last); these empty strings are replaced by 'b'. (Actually
> there are infinite empty strings in those places. But Lua always goes at
> least one step ahead after each match.)
Strictly Logical, to find 1 empty string is just as right or wrong as
to find none, two or infinite empty strings.
> The "fix" would be to add an explicit check for unfinished captures. I
> am not sure it is worth the trouble.
Depends, if the trouble would be 1 line of code, it would easily be
worth it, anything that helps coders to catch an error sooner than
later can safe tons of work in the worst case.