lua-users home
lua-l archive

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


2018-02-16 14:13 GMT+02:00 albertmcchan <albertmcchan@yahoo.com>:
> I post this about a month ago.  I've found a simple lpeg re pattern for above
>
> It can handle "repeated" separactor too, say, "(.*)andand(.*) too.
>
> pat = re.compile( "{ (.(g <- &%z / .g))* } %z {.*}", { z = 'and' } )
>
> note: the loop never match the first position, but it is ok
> the second %z take care of of text with %z up front.

Just remind me ... since `lpeg` and `re` are packages you need
to load into Lua, and standard Lua comes with a string library,
why on earth would you want to do things in `re` that Lua can
already do very well without it?