    #include <string>
    #include <regex>
    
    int main ()
    {
      const std::string someString = "here is some text";
      const std::string output = std::regex_replace(someString.c_str(), std::regex("\\s+"), "\\s*");
    }