fork download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. std::regex mask("skey=(.*)&amp;display");
  8. std::smatch sm;
  9. std::string tmp = "5skey=201608e0cb4b5a3c884f&amp;display_mode=0";
  10. std::string html=R"(<html><head><title>Object moved</title></head><body>
  11. <h2>Object moved to <a href="https://t...content-available-to-author-only...n.com/checkin.aspx?skey=201608e0cb4b5a3c884f&amp;display_mode=0">here</a>.</h2>
  12. </body></html>)";
  13.  
  14. if (!std::regex_search(tmp, sm, mask)) {
  15. std::cout << "match error"<<sm.size();
  16. }else
  17. std::cout<<sm[1];
  18. return 0;
  19. }
Success #stdin #stdout 0s 3552KB
stdin
Standard input is empty
stdout
201608e0cb4b5a3c884f