fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4.  
  5. int main()
  6. {
  7. std::string input = "Content-Type: text/plain";
  8. std::regex contentTypeRegex("Content-Type: (.+)");
  9.  
  10. std::smatch match;
  11.  
  12. if (std::regex_match(input, match, contentTypeRegex)) {
  13. std::ssub_match contentTypeMatch = match[1];
  14. std::string contentType = contentTypeMatch.str();
  15. std::cout << contentType;
  16. }
  17. //else not found
  18. return 0;
  19. }
Success #stdin #stdout 0s 3064KB
stdin
Standard input is empty
stdout
 text/plain