[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lpeg for one who is regexp-poisoned...
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 13 Nov 2014 11:19:23 -0200
> Here's my LPEG search function:
>
>
> function search(patt)
> return (patt + P(1))^0
> end
>
>
> Apply it to any pattern.
Any pattern that does not match the empty string:
patt = lpeg.P'a'^0
search(patt) --> error: loop body may accept empty string
(Also, for internal reasons, the option P{ patt + (1 * V(1)) } is
faster.)
-- Roberto