How many function objects are created to generate that result? From a certain point of view, that is interesting too of course.
I have a quick hack of a Lua library that does pattern matching with linear search. Whenever I get around to making it actually do analysis and compile search functions, I'll put it on github. (The patterns can have variable captures in them, too.)