lua-users home
lua-l archive

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

2013/4/29 Alexey Melnichuk <>:

> 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*"
logically, BUT:

  (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.