std::match_results
Defined in header <regex>
|
||
template< class BidirectionalIterator, |
(since C++11) | |
The class template std::match_results holds a collection of character sequences that represent the result of a regular expression match.
This is a specialized allocator-aware container. It can only be default created or modified by passing to the std::regex_search() or std::regex_match() algorithms.
The first sub_match (index 0) contained in a match_result always represents the full match within a target sequence made by a regex, and subsequent sub_matches represent sub-expression matches corresponding in sequence to the left parenthesis delimiting the sub-expression in the regex.
Several specializations for common character sequence types are provided:
Defined in header <regex>
| |
Type | Definition |
cmatch | match_results<const char*> |
wcmatch | match_results<const wchar_t*> |
smatch | match_results<std::string::const_iterator> |
wsmatch | match_results<std::wstring::const_iterator> |
Contents |
[edit] Member types
Member type | Definition |
allocator_type | Allocator |
value_type | std::sub_match<BidirectionalIterator> |
const_reference | const value_type& |
reference | const_reference |
const_iterator | implementation defined (depends on the underlying container) |
iterator | const_iterator |
difference_type | std::iterator_traits<BidirectionalIterator>::difference_type |
size_type | std::allocator_traits<Allocator>::size_type |
char_type | std::iterator_traits<BidirectionalIterator>::value_type |
string_type | std::basic_string<char_type> |
[edit] Member functions
constructs the object (public member function) | |
destructs the object (public member function) | |
assigns the contents (public member function) | |
returns the associated allocator (public member function) | |
State | |
(public member function) | |
Size | |
checks whether the match was successful (public member function) | |
returns the number of matches in a fully-established result state (public member function) | |
returns the maximum possible number of sub-matches (public member function) | |
Element access | |
returns the length of the particular sub-match (public member function) | |
returns the position of the first character of the particular sub-match (public member function) | |
returns the sequence of characters for the particular sub-match (public member function) | |
returns specified sub-match (public member function) | |
returns sub-sequence between the beginning of the target sequence and the beginning of the full match. (public member function) | |
returns sub-sequence between the end of the full match and the end of the target sequence (public member function) | |
Iterators | |
returns iterator to the beginning of the list of sub-matches (public member function) | |
returns iterator to the end of the list of sub-matches (public member function) | |
Format | |
formats match results for output (public member function) | |
Modifiers | |
swaps the contents (public member function) |
[edit] Non-member functions
lexicographically compares the values in the two match result (function template) | |
specializes the std::swap() algorithm (function template) |