lua-users home
lua-l archive

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


i now have a fast and elegant lpeg pattern:

function drop3(s) return s:sub(1, -4) end          -- drop last 'and'

pat = C({1 * V(1) + 'and'}) / drop3 * C(P(1)^0)

= pat:match("this and that and this and more")

this and that and this
 more