aboutsummaryrefslogtreecommitdiff
path: root/challenge-110/stuart-little/lua/ch-1.lua
diff options
context:
space:
mode:
authorDave Jacoby <jacoby.david@gmail.com>2021-07-12 10:48:31 -0400
committerDave Jacoby <jacoby.david@gmail.com>2021-07-12 10:48:31 -0400
commit34a6514808c066bee4e7f3d7d8bdeb67db056392 (patch)
tree05d0e268045ef3d6f971ec0e0c3eb1a48bdb7edd /challenge-110/stuart-little/lua/ch-1.lua
parentb59f8f4008bb8ec491a9e89f097f04ce54aed4c0 (diff)
parent1aa7b6eaba2a58fc1ef0612373e3aed6b61f345d (diff)
downloadperlweeklychallenge-club-34a6514808c066bee4e7f3d7d8bdeb67db056392.tar.gz
perlweeklychallenge-club-34a6514808c066bee4e7f3d7d8bdeb67db056392.tar.bz2
perlweeklychallenge-club-34a6514808c066bee4e7f3d7d8bdeb67db056392.zip
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
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