宿題に似ているのが残念です。しかし、std :: regexを使用して、日、月、年を解析できませんでした。何が欠けているのかわかりません。
#include<iostream>
#include<string>
#include<vector>
#include<regex>
int main()
{
std::vector<std::string> series;
series.push_back("2013-02-01,54.87,55.20,54.67,54.92,2347600,54.92");
series.push_back("2013-01-31,54.74,54.97,53.99,54.29,3343300,54.29");
series.push_back("2013-01-30,54.84,55.35,54.68,54.68,2472800,54.68");
const std::regex date("(\\d{4})-(\\d{2})-(\\d{2})");
std::smatch dates;
for (unsigned int i = 0; i < series.size() ; i++)
{
if (std::regex_match(series[i], dates, date))
std::cout << dates[1] << "\t" << dates[2] << "\t" << dates[3] << std::endl;
else
std::cout << "No match!" << std::endl;
}
return 0;
}