#include <iostream>
#include <string>
#include <regex>
int main()
{
std::string search_term = "apples oranges";
search_term = std::regex_replace(search_term, std::regex("\\s+"), ".*");
std::string term = "apples pears oranges";
std::smatch matches;
std::string url = "https://a...content-available-to-author-only...m.com/e/is/7ece90d";
std::string amazon_regex = "^https://[a-z\d\-]+\.amazon-adsystem\.com/";
if (std::regex_search(url, matches, std::regex(amazon_regex)))
std::cout << "Match: " << matches[0] << std::endl;
else
std::cout << "No match!" << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8cmVnZXg+CgppbnQgbWFpbigpCnsKCXN0ZDo6c3RyaW5nIHNlYXJjaF90ZXJtID0gImFwcGxlcyBvcmFuZ2VzIjsKCXNlYXJjaF90ZXJtID0gc3RkOjpyZWdleF9yZXBsYWNlKHNlYXJjaF90ZXJtLCBzdGQ6OnJlZ2V4KCJcXHMrIiksICIuKiIpOwoKCXN0ZDo6c3RyaW5nIHRlcm0gPSAiYXBwbGVzIHBlYXJzIG9yYW5nZXMiOwoJc3RkOjpzbWF0Y2ggbWF0Y2hlczsKCQoJc3RkOjpzdHJpbmcgdXJsID0gImh0dHBzOi8vYS4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4ubS5jb20vZS9pcy83ZWNlOTBkIjsKCXN0ZDo6c3RyaW5nIGFtYXpvbl9yZWdleCA9ICJeaHR0cHM6Ly9bYS16XGRcLV0rXC5hbWF6b24tYWRzeXN0ZW1cLmNvbS8iOwoKCWlmIChzdGQ6OnJlZ2V4X3NlYXJjaCh1cmwsIG1hdGNoZXMsIHN0ZDo6cmVnZXgoYW1hem9uX3JlZ2V4KSkpCgkJc3RkOjpjb3V0IDw8ICJNYXRjaDogIiA8PCBtYXRjaGVzWzBdIDw8IHN0ZDo6ZW5kbDsKCWVsc2UKCQlzdGQ6OmNvdXQgPDwgIk5vIG1hdGNoISIgPDwgc3RkOjplbmRsOwoKCXJldHVybiAwOwp9