new to regex,
what is the correct regex form I should use in order to get all occurrences of Cat (case sensitive) within the following string at any position and surrounding characters (or whitespaces)
std::string s(" Cat CatCat CCatt CatcatCat Cat");
std::regex e("(.*)(Cat)(.*)");
std::smatch sm;
std::regex_match (s,sm,e);
std::cout << "there's " << sm.size() << " Cats\n";
I get "there's 4 Cats", when it should be 7 Cats. I'm missing 3 Cats. :)
Thanks in advance.