fork(2) download
  1. #include <string>
  2. #include <iostream>
  3. #include <regex>
  4. using namespace std;
  5.  
  6. int main() {
  7. std::vector<std::string> strings;
  8. std::string s = "1 This is an exampl";
  9. std::regex re("\\b(?=e)");
  10. std::regex_token_iterator<std::string::iterator> it(s.begin(), s.end(), re, -1);
  11. decltype(it) end{};
  12. while (it != end){
  13. strings.push_back(*it++);
  14. std::cout << strings[strings.size()-1] << std::endl; // DEMO!
  15. }
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 3560KB
stdin
Standard input is empty
stdout
1 This is an 
exampl