#include "pch.h"
#include <regex>
#include <iterator>
#include <iostream>
#include <string>
int main()
{
const std::string s = "0,雷电模拟器,0,0,0,-1,-1\r\n1,雷电模拟器-1,0,0,0,-1,-1\r\n2,雷电模拟器-2,0,0,0,-1,-1\r\n3,雷电模拟器-1-3,0,0,0,-1,-1\r\n4,雷电模拟器-4,0,0,0,-1,-1\r\n5,雷电模拟器-1-5,0,0,0,-1,-1\r\n";
std::regex words_regex("(?<=^|,|\\r\\n).*?(?=,|\\r\\n)");
auto words_begin =
std::sregex_iterator(s.begin(), s.end(), words_regex);
auto words_end = std::sregex_iterator();
std::cout << "Found "
<< std::distance(words_begin, words_end)
<< " words:\n";
for (std::sregex_iterator i = words_begin; i != words_end; ++i) {
std::smatch match = *i;
std::string match_str = match.str();
std::cout << match_str << '\n';
}
}