lua-users home
lua-l archive

Re: how to translate lua pattern "(.*)and(.*)" with lpeg re ?

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


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

AltStyle によって変換されたページ (->オリジナル) /