std::regex equivalent of '/g' global modifier
In Perl, I can do this: $text = '1747239'; @matches = ($text =~ m/(\d)/g); # @matches now contains ('1', '7', '4', '7', '2', '3', '9') Using C++ regex matching, what's the best way to replicate this behaviour so that I get a match set including all the matches? I have this at the moment:- compiledRegex = std::regex(regex, std::tr1::regex_constants::extended); regex_search(text, results, compiledRegex); int count = results.size(); // Alloc pointer array based on count * sizeof(mystruct). for ( std::cmatch::iterator match = results.begin(); match != results.end(); ++match ) { // Do something