lua-users home
lua-l archive

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

I'm having some odd behaviour with gsub in 5.0 alpha; If I call:

    gsub("string", ".+", "x")

It will return "x", 1, whch is what I'd expect.  However, if I use:

    gsub("string", ".*", "x")

then it returns   "xx", 2

Now I guess technically .* matches an empty string, so one could argue that
it would make an infinite number of replacements.

However, given that it says it matches the longest possible string in the
docs, I would've expected to get a single substitution, not 2.


Love, Light and Peace,
- Peter Loveday
Director of Development, eyeon Software