You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
493 B
27 lines
493 B
#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");
|
|
}
|
|
}
|
|
}
|
|
|