[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: how to translate lua pattern "(.*)and(.*)" with lpeg re ?
- From: Nick Gammon <nick@...>
- Date: Sun, 21 Jan 2018 13:51:18 +1100
On 21/01/18 13:33, Sean Conner wrote:
I'm thinking the input is something like:
this and that and the other
Yes, I can reproduce the issue with "foo and bar and whatever" as I get a match of:
1 = foo
2 =bar and whatever
I can't for the life of me work out how to match up the *last* and (which would be the greedy match).
A pattern like: { (!'and' .)*} 'and' {.*}
... consumes up to the first 'and'. I need to somehow say "keep consuming until 'and' doesn't appear any more".
- Nick