fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4.  
  5. int main()
  6. {
  7. std::string source="It's a book.";
  8. std::regex syntax("(a|an|the)\\s+[A-Za-z]+");
  9. for(std::sregex_iterator end,i(source.begin(),source.end(),syntax);i!=end;++i)
  10. {
  11. std::cout<<i->str()<<std::endl;
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0s 3548KB
stdin
Standard input is empty
stdout
a book