Should be simple to embed fengari (or just rip the code out of it) to run the given lua pattern on a blob of text.