[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal for lpeg
- From: albertmcchan <albertmcchan@...>
- Date: Thu, 8 Feb 2018 18:00:58 -0500
On Feb 7, 2018, at 5:49 PM, albertmcchan <albertmcchan@yahoo.com> wrote:
> to make re.anywhere more convenient, i added = prefix in re.lua for anywhere search
> this produce very readable lpeg re pattern
>
> t = 'this and that and whatever'
>
> -- search for end position of that
> = re.match(t, "= 'that'")
> 14
>
> -- search for start and end of 'that'
> = re.match(t, "=({} 'that' {})")
> 10 14
>
> -- lua pattern ".*and(.*)"
> = re.match(t, "(= 'and')+ {.*}")
> whatever
reply to myself, =name already have meaning, so above patch will fail lpeg test.lua
maybe using '>' instead for anywhere search ?