fork(3) download
  1. #include <string>
  2. #include <iostream>
  3. #include <regex>
  4. using namespace std;
  5.  
  6. int main() {
  7. std::regex reg_expr(R"(\([A-Z],[A-Z]\))");
  8. string input("(A,B) (C,D) (F,W) (G,K) (R,M)");
  9. for(std::sregex_iterator i = std::sregex_iterator(input.begin(), input.end(), reg_expr);
  10. i != std::sregex_iterator();
  11. ++i)
  12. {
  13. std::cout << (*i).str() << std::endl;
  14. }
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 3556KB
stdin
Standard input is empty
stdout
(A,B)
(C,D)
(F,W)
(G,K)
(R,M)