[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lpeg pattern repetition
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 2 Jun 2008 00:25:32 -0300
> 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