import std.stdio;
import std.regexp;

char[][] lines = [
"       0        0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           ",
"       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 21 ",
"       0        0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 21 ",
"      36     2540 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 22 ",
"       0        0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 22 ",
"       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 80 ",
"       0        0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 80 ",
"      10      492 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 655 ",
"      16     5000 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 655 ",
"       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 990 ",
"       0        0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 990 ",
"       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 902,8333 ",
"       0        0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 902,8333 ",
"       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 8767,14534,51234 ",
"       0        0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 8767,14534,51234 ",
"       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 28960,20800,20810 ",
"      25     1072 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 28960,20800,20810 ",
"       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 49000:49999 ",
"       0        0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 49000:49999 ",
"       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 16567,29900,29901 ",
"      31     1798 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 16567,29900,29901 ",
"       0        0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 53 ",
"       0        0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 53 ",
"      92    10111 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           ",
"       2      100 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           ",
"       0        0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           ",
];

void main() {
    RegExp ruleLine = RegExp("^\\s+(\\d+)\\s+(\\d+)\\s+\\w+\\s+(\\w+)\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+(.*)\r?\n?$");

    for (int i=0; i<lines.length; i++) {
        char[] l = lines[i];
        char[][] m = ruleLine.match(l);
        writefln("%sMATCHED: %s", (m.length==0)?"UN":"", l);
    }
}
