#include <iostream>
#include <regex>
#include <vector>
int main() {
// Declare the regex pattern
std::regex pattern("htt+p");
// Test strings
std::vector<std::string> testStrings = {"http", "htttp", "httttp", "httpp", "htp"};
// Check matches
for (const auto& test : testStrings) {
bool match = std::regex_match(test, pattern);
std::cout << "Matches \"" << test << "\": " << std::boolalpha << match << std::endl;
}
}
// Matches "httpp": True or false, depending on how matches() method works
/*
run:
Matches "http": true
Matches "htttp": true
Matches "httttp": true
Matches "httpp": false
Matches "htp": false
*/