std::match_results::str
From Cppreference
< cpp | regex | match results
difference_type str( size_type sub = 0 ) const;
|
(C++11 feature) | |
This section is incomplete |
[edit] Parameters
sub | - | Indicates the sub_match. |
[edit] Return value
Returns the indicated match or sub-match within the target sequence a std::basic_string of the underlying character type.
[edit] Example
#include <iostream> #include <regex> #include <string> int main() { std::regex re("a(a)*b"); std::string target("aaab"); std::smatch sm; std::regex_match(target, sm, re); std::cout << sm.str(1) << '\n'; }
Output:
aaa