#include "tads.h" #include "t3.h" preinit() { } main(args) { local alloc = (args.indexOf('-alloc') != nil); if (alloc) "(Allocating RexPattern objects.)\n"; "args = [<>]\n"; for (;;) { local pat, str, match; "regular expression: "; pat = inputLine(); if (pat == '') break; if (alloc) pat = new RexPattern(pat); "string: "; str = inputLine(); match = rexSearch(pat, str); if (match == nil) "No match.\n"; else { "Match=[<>] (ofs <>, len <>)\n"; for (local i = 1 ; i < 9 ; ++i) { local g = rexGroup(i); if (g != nil) "group <> = '<>'\n"; } } "\b"; } }