aboutsummaryrefslogtreecommitdiff
path: root/challenge-110/stuart-little/lua/ch-1.lua
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-110/stuart-little/lua/ch-1.lua')
-rwxr-xr-xchallenge-110/stuart-little/lua/ch-1.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-110/stuart-little/lua/ch-1.lua b/challenge-110/stuart-little/lua/ch-1.lua
new file mode 100755
index 0000000000..8444d9cd03
--- /dev/null
+++ b/challenge-110/stuart-little/lua/ch-1.lua
@@ -0,0 +1,13 @@
+#!/usr/bin/env lua
+
+-- run <script> <file>
+
+require('luarocks.loader')
+local re = require('re')
+
+for l in io.lines(arg[1]) do
+ local mtch = table.pack(re.match(l, "({'+'%d^2%s+%d^10 / '('%d^2')'%s+%d^10 / %d^4%s+%d^10/.})*"))
+ for _,v in ipairs(mtch) do
+ if v:len() > 1 then print(v) end
+ end
+end