fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4.  
  5. int main(){
  6. // Variables for user input
  7. std::string input_line(" #load \"my folder/my files/ program.prog\" ;");
  8. // Remove leading/trailing whitespaces
  9. input_line = std::regex_replace(input_line, std::regex(R"(^ +| +$|(\"[^\"\\]*(?:\\[\s\S][^\"\\]*)*\")|( ) +)"), "$1$2");
  10.  
  11. // Check result
  12. std::cout << input_line << std::endl;
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 4496KB
stdin
Standard input is empty
stdout
#load "my   folder/my  files/    program.prog" ;