19inline std::vector<std::string>
findFromFile(
const std::string &filePath,
const std::string &pattern,
20 std::string &lastWord)
22 const std::regex regExp(pattern);
23 std::ifstream inFile(filePath);
24 std::vector<std::string> matchedLines;
27 while (getline(inFile, readLine))
29 if (std::regex_search(readLine, regExp))
31 matchedLines.push_back(readLine);
35 if (!matchedLines.empty())
37 auto pos = matchedLines.front().find_last_of(
' ');
38 if (pos != std::string::npos && pos != matchedLines.front().size())
40 lastWord = matchedLines.front().substr(pos + 1);