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.
28 lines
493 B
28 lines
493 B
4 months ago
|
#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 {
|
||
4 months ago
|
regex to_test(argv[1]);
|
||
|
string line(argv[2]);
|
||
|
|
||
4 months ago
|
if(regex_match(line, matches, to_test)) {
|
||
|
println("MATCHED: ");
|
||
|
|
||
|
for(auto &match : matches) {
|
||
|
println("\t{}", match.str());
|
||
|
}
|
||
|
} else {
|
||
|
println("NO MATCH");
|
||
|
}
|
||
|
}
|
||
|
}
|