lua-users home
lua-l archive

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


added ".*" at the end of the pattern. I'd assume that would not change
anything, but it does:

lpeg=require"lpeg"
require"re"

print("lpeg version", lpeg.version())

x = {re.find('hello', [[ { 'h' . . } { . } { . } .* -> {} ]])}

print(type(x), #x, x[1], x[2], x[3], x[4], x[5])
print(type(x[4]), #x[4], x[4][1])
print(type(x[5]), #x[5], x[5][1])

prints

lpeg version	0.8
table	5	1	hel	l	o	table: 0xa854e0
string	1	nil
table	0	nil

So now I get the 3rd capture in x[4] as expected, but still an
additional (empty) table as the last element

</nk>