Re: lpeg.U ?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: lpeg.U ?
- From: albertmcchan <albertmcchan@...>
- Date: 2018年1月25日 21:33:36 -0500
On Jan 25, 2018, at 8:03 PM, Sean Conner <sean@conman.org> wrote:
> If you are looking for a final "and" (which ends the input), then this
> works:
>
> last_and = P"and" * P(-1)
> char = R("0円96円","b255円")^1
> + -last_and * P"a"
> pat = C((char)^0) * last_and
>
> print(pat:match(string.rep("this and that land",400) .. "and"))
>
your example also shows usefulness of undo lpeg.U (if exist):
pat = C( P(1)^3 * U(3) * #P'and' )