lua-users home
lua-l archive

LPeg and numbered capture

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


I just can't seem to make it work...
The facts: on Windows 7, using Lua 5.1.4 and LPeg 0.10.2
I try something simple:
local cap = m.R('AZ')
local caps = ((1 - cap) + m.C(cap))^0
local toMatch = "Everybody's Got Something to Hide Except Me and My Monkey"
print(m.match(caps, toMatch))
print(m.match(caps / 1, toMatch))
The first call works, showing the uppercase letters.
The second call gives a runtime error:
lua: LPegPlayground.lua:5: bad argument #2 to '?' (invalid replacement value)
Is the numbered capture actually implemented in this version?
Or am I missing something?
This kind of capture is hard to google... I haven't found an example in the test file coming with LPeg either.
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- http://PhiLho.deviantART.com
-- -- -- -- -- -- -- -- -- -- -- -- -- --

AltStyle によって変換されたページ (->オリジナル) /