[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal for lpeg
- From: Sean Conner <sean@...>
- Date: Tue, 6 Feb 2018 13:46:45 -0500
It was thus said that the Great albertmcchan once stated:
> lpeg.P always match at beginning of string, maybe an efficient matching anywhere function ?
You do realize that all LPeg functions take an optional starting position.
> Example:
> keywords = P'while' + 'repeat' + 'for'
>
> to search keywords anywhere efficiently, skip all bad head chars
>
> skip = 1 - S"wrf" -- set of skipped chars
Have you timed the above vs
skip = P(1) - keywords
-spc