Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #regex #count #number #matches
ADD COMMENT
Topic
Name
7+9 =