[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: A bug in string.gmatch and string.gsub?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 29 Apr 2013 17:50:16 +0200
2013/4/29 Alexey Melnichuk <email@example.com>:
> May be you want : string.gsub(";a;", "a+", "ITEM") ?
No, I don't. That is exactly what the Wiki page suggests. It gives
";ITEM;". It's more reasonable than "ITEM;ITEMITEM;ITEM", but I want
"ITEM;ITEM;ITEM". It should not be necessary, given Lua's elegant
patterns, to devote a 300-line webpage discussing how hard it is
to implement `split`.
I agree that there is a way to explain the current behaviour of "a*"
(a) That way is based on a rule not stated in the documentation,
(b) which is not the only possible rule consistent with it.
(c) Another rule can be proposed,
(d) which is consistent with the way `sed` behaves,
(e) appears to be more intuitive,
(f) and can be implemented quite efficiently.