lua-users home
lua-l archive

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


Lua manual says:
>  For this function, a caret '^' at the start of a pattern
> does not work as an anchor, as this would prevent
> the iteration.

Amazingly, $ still works as an anchor!
Why is it so asymmetric?
Does $ prevent the iteration, therefore must be disabled also?

It is funny that one can get more than 1 match
with $-anchored pattern:
for a in ('Lua'):gmatch'.*$' do print(a) end
for a in ('Lua'):gmatch'().*$' do print(a) end
 :-)