Answers for "c++ regex count number of matches"

C++
0

c++ regex count number of matches

std::regex  const expression("[^\\s]+");
std::string const text("Harry Botter - The robot who lived.");

std::ptrdiff_t const match_count(std::distance(
    std::sregex_iterator(text.begin(), text.end(), expression),
    std::sregex_iterator()));

std::cout << match_count << std::endl;
Posted by: Guest on February-26-2022

Code answers related to "c++ regex count number of matches"

Browse Popular Code Answers by Language