lua-users home
lua-l archive

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


> 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