[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Anchors in string.gmatch()
- From: Egor Skriptunoff <egor.skriptunoff@...>
- Date: Mon, 20 Aug 2012 01:20:43 +0300
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
:-)