fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <regex>
  4.  
  5. int main() {
  6. const std::regex includeRegex(R"(\b[[:alpha:]]+\b)");
  7. std::smatch match;
  8. std::string test = "abcd LastMatch РОДИНА";
  9. std::vector<std::string> results(std::sregex_token_iterator(test.begin(), test.end(), includeRegex),
  10. std::sregex_token_iterator());
  11.  
  12. std::cout << results.size() << std::endl;
  13. for (auto result : results)
  14. {
  15. std::cout << result << std::endl;
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5424KB
stdin
Standard input is empty
stdout
2
abcd
LastMatch