lua-users home
lua-l archive

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


Happy Summer, everyone :-)

What is "Lua idiom" -- using the regular string library, not lpeg or any 
of the RE add-ons -- when doing string matching with alternative 
strings in it. For example, something like this:

  "eat (green|yellow)? (bananas|apples) daily"

(Assuming the round brackets are for alternation, not capture.)

Of idiomatic Lua solutions, especially when rather more complex patterns 
are involved (notably with optional or repeated components, or with 
captures and backmatches), which way is fastest? Which is most elegant?