        for(j = 0; j &lt; what.captures(i).size(); ++j)
         {
            if(j)
               std::cout &lt;&lt; ", ";
            else
               std::cout &lt;&lt; " ";
            std::cout &lt;&lt; "\"" &lt;&lt; what.captures(i)[j] &lt;&lt; "\"";
         }
         std::cout &lt;&lt; " }\n";
      }
   }
   else
   {
      std::cout &lt;&lt; "** No Match found **\n";
   }
}

int main(int , char* [])
{
   print_captures("(([[:lower:]]+)|([[:upper:]]+))+", "aBBcccDDDDDeeeeeeee");
   print_captu