[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: Fri, 16 Feb 2018 07:13:20 -0500
I post this about a month ago. I've found a simple lpeg re pattern for above
It can handle "repeated" separactor too, say, "(.*)andand(.*) too.
pat = re.compile( "{ (.(g <- &%z / .g))* } %z {.*}", { z = 'and' } )
note: the loop never match the first position, but it is ok
the second %z take care of of text with %z up front.