52 std::string pattern(
"([-+]?[0-9]+\\*[-+]?[0-9.eE+-]+|[-+]?[0-9,.eE+-]+)");
54 std::vector<std::string> str;
55 std::stringstream ss(fn);
64 while (index < section.size() && std::isspace(section[index]))
69 section.erase(0, index);
70 str.push_back(section);
75 regcomp(®, pattern.c_str(), REG_EXTENDED);
77 const size_t nmatch = 1;
80 for (
size_t i = 0; i < str.size(); ++i)
86 int status = regexec(®, str[i].c_str(), nmatch, pmatch, 0);
87 std::string sub_str =
"";
90 for (
size_t j = pmatch[0].rm_so; j != pmatch[0].rm_eo; ++j)
96 std::string sub_pattern(
"\\*");
98 regcomp(&sub_reg, sub_pattern.c_str(), REG_EXTENDED);
99 regmatch_t sub_pmatch[1];
100 const size_t sub_nmatch = 1;
102 if (regexec(&sub_reg, sub_str.c_str(), sub_nmatch, sub_pmatch, 0) == 0)
104 size_t pos = sub_str.find(
"*");
105 int num = stoi(sub_str.substr(0, pos));
107 T occ = stof(sub_str.substr(pos + 1, sub_str.size()));
110 for (
size_t k = 0; k != num; k++)
112 vec.emplace_back(occ);
118 std::stringstream convert;
122 vec.emplace_back(occ);