fork(2) download
  1. #include <regex>
  2. #include <iostream>
  3.  
  4. int main()
  5. {
  6. std::string uri = "http://e...content-available-to-author-only...e.com/test.html";
  7. std::regex reg("^(.+):\\/\\/(.+@)?([a-zA-Z\\.\\-0-9]+)(:\\d{1,5})?([^?\\n\\#]*)(\\?[^#\\n]*)?(\\#.*)?$");
  8. std::smatch match;
  9. std::regex_match(uri, match, reg);
  10. for(auto& e: match)
  11. {
  12. std::cout<<e.str() <<std::endl;
  13. }
  14. }
  15.  
Success #stdin #stdout 0s 3552KB
stdin
Standard input is empty
stdout
http://e...content-available-to-author-only...e.com/test.html
http

example.com/test.html