#include <fmt/core.h>
#include <regex>
#include <string>

using namespace fmt;
using namespace std;

int main(int argc, char *argv[]) {
  smatch matches;

  if(argc != 3) {
    println("USAGE: regtest <regex> <line>");
  } else {
    regex to_test(argv[1]);
    string line(argv[2]);

    if(regex_match(line, matches, to_test)) {
      println("MATCHED: ");

      for(auto &match : matches) {
        println("\t{}", match.str());
      }
    } else {
      println("NO MATCH");
    }
  }
}