fork(1) download
  1. #include <fstream>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <iterator>
  5. #include <regex>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10. std::string text = "One, two, three";
  11. std::regex ws_re(",\\s+"); // whitespace
  12. std::copy( std::sregex_token_iterator(text.begin(), text.end(), ws_re, -1),
  13. std::sregex_token_iterator(),
  14. std::ostream_iterator<std::string>(std::cout, "\n"));
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 16168KB
stdin
Standard input is empty
stdout
One
two
three