lua-users home
lua-l archive

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


> I want to match on "Nick says hello" where "Nick" can vary.

option 1: 
  p =lpeg.P{" says hello" + 1 * lpeg.V(1)}

option 2:
  line = lpeg.P" says hello"
  p = (1 - line)^0 * line


You should have a look at the lpeg paper:
  
  A Text Pattern-Matching Tool based on Parsing Expression Grammars
  http://www.inf.puc-rio.br/~roberto/docs/peg.pdf

-- Roberto