A little better build but I really need to clean this up and use a state machine to handle the process.

This commit is contained in:
Zed A. Shaw 2024-08-01 07:01:27 -04:00
parent 93b181cdbc
commit 899e481c9d
4 changed files with 80 additions and 59 deletions

26
regtest.cpp Normal file
View file

@ -0,0 +1,26 @@
#include <fmt/core.h>
#include <regex>
#include <string>
using namespace fmt;
using namespace std;
int main(int argc, char *argv[]) {
smatch matches;
regex to_test(argv[1]);
string line(argv[2]);
if(argc != 3) {
println("USAGE: regtest <regex> <line>");
} else {
if(regex_match(line, matches, to_test)) {
println("MATCHED: ");
for(auto &match : matches) {
println("\t{}", match.str());
}
} else {
println("NO MATCH");
}
}
}