Difference between revisions of "cpp/regex/match results"
m (Text replace - "{{mark c++11 feature}}" to "{{mark since c++11}}") |
m (Text replace - "{{cpp|" to "{{c|") |
||
Line 8: | Line 8: | ||
}} | }} | ||
− | The class template {{ | + | 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 {{ | + | 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. | 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. | ||
Line 19: | Line 19: | ||
{{tdcl list header | regex}} | {{tdcl list header | regex}} | ||
{{tdcl list hitem | Type | Definition}} | {{tdcl list hitem | Type | Definition}} | ||
− | {{tdcl list item | {{tt|cmatch}} | {{ | + | {{tdcl list item | {{tt|cmatch}} | {{|match_results<const char*>}}}} |
− | {{tdcl list item | {{tt|wcmatch}} | {{ | + | {{tdcl list item | {{tt|wcmatch}} | {{|match_results<const wchar_t*>}}}} |
− | {{tdcl list item | {{tt|smatch}} | {{ | + | {{tdcl list item | {{tt|smatch}} | {{|match_results<std::string::const_iterator>}}}} |
− | {{tdcl list item | {{tt|wsmatch}} | {{ | + | {{tdcl list item | {{tt|wsmatch}} | {{|match_results<std::wstring::const_iterator>}}}} |
{{tdcl list end}} | {{tdcl list end}} | ||
Line 28: | Line 28: | ||
{{tdcl list begin}} | {{tdcl list begin}} | ||
{{tdcl list hitem | Member type | Definition}} | {{tdcl list hitem | Member type | Definition}} | ||
− | {{tdcl list item | {{tt|allocator_type}} | {{ | + | {{tdcl list item | {{tt|allocator_type}} | {{|Allocator}}}} |
− | {{tdcl list item | {{tt|value_type}} | {{ | + | {{tdcl list item | {{tt|value_type}} | {{|std::sub_match<BidirectionalIterator>}}}} |
− | {{tdcl list item | {{tt|const_reference}} | {{ | + | {{tdcl list item | {{tt|const_reference}} | {{|const value_type&}}}} |
− | {{tdcl list item | {{tt|reference}} | {{ | + | {{tdcl list item | {{tt|reference}} | {{|const_reference}}}} |
{{tdcl list item | {{tt|const_iterator}} | ''implementation defined'' (depends on the underlying container)}} | {{tdcl list item | {{tt|const_iterator}} | ''implementation defined'' (depends on the underlying container)}} | ||
− | {{tdcl list item | {{tt|iterator}} | {{ | + | {{tdcl list item | {{tt|iterator}} | {{|const_iterator}}}} |
− | {{tdcl list item | {{tt|difference_type}} | {{ | + | {{tdcl list item | {{tt|difference_type}} | {{|std::iterator_traits<BidirectionalIterator>::difference_type}}}} |
− | {{tdcl list item | {{tt|size_type}} | {{ | + | {{tdcl list item | {{tt|size_type}} | {{|std::allocator_traits<Allocator>::size_type}}}} |
− | {{tdcl list item | {{tt|char_type}} | {{ | + | {{tdcl list item | {{tt|char_type}} | {{|std::iterator_traits<BidirectionalIterator>::value_type}}}} |
− | {{tdcl list item | {{tt|string_type}} | {{ | + | {{tdcl list item | {{tt|string_type}} | {{|std::basic_string<char_type>}}}} |
{{tdcl list end}} | {{tdcl list end}} | ||
Revision as of 21:42, 19 April 2012
Template:cpp/regex/match results/sidebar
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:
Template:tdcl list begin Template:tdcl list header Template:tdcl list hitem Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list end
Contents |
Member types
Template:tdcl list begin Template:tdcl list hitem Template:tdcl list item Template:tdcl list item