fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string str = "Just a string :)";
  10.  
  11. string res = regex_replace(str, regex("^\\W*(\\w+).*$"), "$1");
  12. cout << res << endl;
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 16168KB
stdin
Standard input is empty
stdout
Just