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:
parent
93b181cdbc
commit
899e481c9d
4 changed files with 80 additions and 59 deletions
26
regtest.cpp
Normal file
26
regtest.cpp
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue