[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Emulating advanced regex features using Lua patterns and pure Lua code
- From: Wim Couwenberg <wim.couwenberg@...>
- Date: Mon, 20 Jun 2011 13:55:15 +0200
My strategy is to match more than you want and then filter the results in code:
local text = string.match(haystack, "^[fb][oa][or]$)
if text == "foo" then
...
elseif text == "bar" then
...
else
-- no match
end
Takes a little preprocessing of the pattern but I prefer 100% lua code
over package dependencies any time and the Lua code is fairly trivial.
bye,
Wim