lua-users home
lua-l archive

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


On Jan 21, 2018, at 12:56 AM, Nick Gammon <nick@gammon.com.au> wrote:

> On 21/01/18 16:42, albertmcchan wrote:
>> pat = C({1 * V(1) + 'and'}) / drop3 * C(P(1)^0)
> 
> That's not using re, though, which is what the subject line is about.

above lpeg translate to lpeg re:

pat = re.compile( "({g <- .g / 'and'} -> drop3) {.*}", {drop3=drop3} )

i have now a more elegant lpeg re pattern:

pat = re.compile "{g <- .g / &'and'} 'and' {.*}"