.TH std::sub_match::operatorstring_type,std::sub_match::str 3 "2022.07.31" "http://cppreference.com" "C++ Standard Libary" .SH NAME std::sub_match::operatorstring_type,std::sub_match::str \- std::sub_match::operatorstring_type,std::sub_match::str .SH Synopsis operator string_type() const; \fB(1)\fP string_type str() const; \fB(2)\fP Converts to an object of the underlying std::basic_string type. The first version is an implicit conversion, the second one is explicit. .SH Parameters \fI(none)\fP .SH Return value Returns the matched character sequence as an object of the underlying std::basic_string type. If the matched member is false, then the empty string is returned. .SH Complexity Linear in the length of the underlying character sequence. .SH Example // Run this code #include #include #include #include int main() { const std::string html {R"(")"}; const std::regex url {"https://([a-z]+)\\\\.([a-z]{3})"}; std::smatch parts; std::regex_search(html, parts, url); for (std::ssub_match const& sub: parts) { const std::string s = sub; // (1) implicit conversion assert(s == sub.str()); // (2) std::cout << s << '\\n'; } } .SH Output: https://cppreference.com cppreference com