ref: 5ed7c4731bfc96db39875e48237404a9f0838d38
dir: /test/testmatch.myr/
use std use regex pkg = const testmatch : (pat : byte[:], text : byte[:] -> void) const dbgmatch : (pat : byte[:], text : byte[:] -> void) ;; const testmatch = {pat, text run(regex.compile(pat), text) } const dbgmatch = {pat, text run(regex.dbgcompile(pat), text) } const run = {regex, text var i match regex | `std.Success re: match regex.exec(re, text) | `std.Some m: std.put("Matched. %i matches\n", m.len) for i = 0; i < m.len; i++ std.put("match %i: %s\n", i, m[i]) ;; | `std.None: std.put("No match\n") ;; regex.free(re) | `std.Failure err: std.put("failed to compile regex") ;; }