std::match_results::swap

void swap( match_results& other ); (since C++11) Exchanges the shared states of two match_results objects. Parameters other - the match_results to swap with Return value (none). Exceptions noexcept specification: noexcept Example See also std::swap(std::match_results) (C++11) specializes the std::swap() algorithm (function template)

std::match_results::suffix

const_reference suffix() const; (since C++11) Obtains a reference to the std::sub_match object representing the target sequence between the end of the entire match of the regular expression and the end of the target sequence. The behavior is undefined unless ready() == true. Parameters (none). Return value Reference to the unmatched suffix. Example #include <iostream> #include <regex> #include <string> int main() { std::regex re("a(a)*b"); std::str

std::match_results::str

string_type str( size_type n = 0 ) const; (since C++11) Returns a string representing the indicated sub-match. If n == 0, a string representing entire matched expression is returned. If n > 0 && n < size(), a string representing nth sub-match is returned. if n >= size(), a string representing the unmatched match is returned. The call is equivalent to string_type((*this)[n]); Parameters n - integral number specifying which match to return Return value Retur

std::match_results::size

size_type size() const; (since C++11) Returns the number of submatches, i.e. std::distance(begin(), end()). Parameters (none). Return value The number of submatches. Exceptions noexcept specification: noexcept Complexity Constant. See also 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::cou

std::match_results::ready

bool ready() const; (since C++11) Indicates if the match results are ready (valid) or not. A default-constructed match result has no result state (is not ready), and can only be made ready by one of the regex algorithms. The ready state implies that all match results have been fully established. The result of calling most member functions of the match_results object that is not ready is undefined. Return value true if the match results are ready, false otherwise. Example #includ

std::match_results::prefix

const_reference prefix() const; (since C++11) Obtains a reference to the std::sub_match object representing the target sequence between the start of the beginning of the target sequence and the start of the entire match of the regular expression. The behavior is undefined unless ready() == true. Parameters (none). Return value Reference to the unmatched prefix. Example #include <iostream> #include <regex> #include <string> int main() { std::regex re("a(a

std::match_results::position

difference_type position( size_type n = 0 ) const; (since C++11) Returns the position of the first character of the specified sub-match. If n == 0, the position of the first character of the entire matched expression is returned. If n > 0 && n < size(), the position of the first character of the nth sub-match is returned. if n >= size(), a position of the first character of the unmatched match is returned. Parameters n - integral number specifying which match to

std::match_results::operator[]

const_reference operator[]( size_type n ) const; (since C++11) If n > 0 and n < size(), returns a reference to the std::sub_match representing the part of the target sequence that was matched by the nth captured marked subexpression). If n == 0, returns a reference to the std::sub_match representing the part of the target sequence matched by the entire matched regular expression. if n >= size(), returns a reference to a std::sub_match representing an unmatched sub-expression (a

std::match_results::max_size

size_type max_size() const; (since C++11) Returns the maximum number of submatches the match_results type is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest number of submatches. Parameters (none). Return value Maximum number of submatches. Exceptions noexcept specification: noexcept Complexity Constant.

std::match_results::match_results

explicit match_results( const Allocator& a = Allocator() ); (1) (since C++11) match_results( const match_results& rhs ); (2) (since C++11) match_results( match_results&& rhs ); (3) (since C++11) 1) Default-constructor. Constructs a match result with no established result state (ready() != true). 2) Copy-constructor. Constructs a match result with a copy of rhs. 3) Move-constructor. Constructs a match result with the contents of rhs using move semantics. rh