[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Lua idiom for RE-style alternation?
- From: duck <duck@...>
- Date: Thu, 7 Jan 2010 07:33:39 +1100 (EST)
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?