Difference between revisions of "cpp/regex/match results"
From cppreference.com
(+type reqs) |
m (r2.7.3) (Robot: Adding de, es, fr, it, ja, pt, ru, zh) |
||
Line 87: | Line 87: | ||
{{dcl list template | cpp/regex/match_results/dcl list swap2}} | {{dcl list template | cpp/regex/match_results/dcl list swap2}} | ||
{{dcl list end}} | {{dcl list end}} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ |
Revision as of 13:30, 2 November 2012
Defined in header <regex>
|
||
template< class BidirIt, |
(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.
Contents |
Type requirements
-BidirIt must meet the requirements of LegacyBidirectionalIterator.
| ||
-Alloc must meet the requirements of Allocator.
|
Specializations
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> |
Member types
Member type | Definition |
allocator_type
|
Allocator |
value_type
|
std::sub_match<BidirIt> |
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<BidirIt>::difference_type |
size_type
|
std::allocator_traits<Alloc>::size_type |
char_type
|
std::iterator_traits<BidirIt>::value_type |
string_type
|
std::basic_string<char_type> |