[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: how to translate lua pattern "(.*)and(.*)" with lpeg re ?
- From: albertmcchan <albertmcchan@...>
- Date: Sun, 21 Jan 2018 13:51:21 -0500
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' {.*}"