Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/regex/match results"

From cppreference.com
< cpp‎ | regex
m (Text replace - "{{tdcl list end" to "{{dcl list end")
m (Text replace - "{{tdcl" to "{{dcl")
Line 17: Line 17:
  
 
{{dcl list begin}}
 
{{dcl list begin}}
{{tdcl list header | regex}}
+
{{list header | regex}}
{{tdcl list hitem | Type | Definition}}
+
{{list hitem | Type | Definition}}
{{tdcl list item | {{tt|cmatch}} | {{c|match_results<const char*>}}}}
+
{{list item | {{tt|cmatch}} | {{c|match_results<const char*>}}}}
{{tdcl list item | {{tt|wcmatch}} | {{c|match_results<const wchar_t*>}}}}
+
{{list item | {{tt|wcmatch}} | {{c|match_results<const wchar_t*>}}}}
{{tdcl list item | {{tt|smatch}} | {{c|match_results<std::string::const_iterator>}}}}
+
{{list item | {{tt|smatch}} | {{c|match_results<std::string::const_iterator>}}}}
{{tdcl list item | {{tt|wsmatch}} | {{c|match_results<std::wstring::const_iterator>}}}}
+
{{list item | {{tt|wsmatch}} | {{c|match_results<std::wstring::const_iterator>}}}}
 
{{dcl list end}}
 
{{dcl list end}}
  
 
===Member types===
 
===Member types===
 
{{dcl list begin}}
 
{{dcl list begin}}
{{tdcl list hitem | Member type | Definition}}
+
{{list hitem | Member type | Definition}}
{{tdcl list item | {{tt|allocator_type}} | {{c|Allocator}}}}
+
{{list item | {{tt|allocator_type}} | {{c|Allocator}}}}
{{tdcl list item | {{tt|value_type}} | {{c|std::sub_match<BidirectionalIterator>}}}}
+
{{list item | {{tt|value_type}} | {{c|std::sub_match<BidirectionalIterator>}}}}
{{tdcl list item | {{tt|const_reference}} | {{c|const value_type&}}}}
+
{{list item | {{tt|const_reference}} | {{c|const value_type&}}}}
{{tdcl list item | {{tt|reference}} | {{c|const_reference}}}}
+
{{list item | {{tt|reference}} | {{c|const_reference}}}}
{{tdcl list item | {{tt|const_iterator}} | ''implementation defined'' (depends on the underlying container)}}
+
{{list item | {{tt|const_iterator}} | ''implementation defined'' (depends on the underlying container)}}
{{tdcl list item | {{tt|iterator}} | {{c|const_iterator}}}}
+
{{list item | {{tt|iterator}} | {{c|const_iterator}}}}
{{tdcl list item | {{tt|difference_type}} | {{c|std::iterator_traits<BidirectionalIterator>::difference_type}}}}
+
{{list item | {{tt|difference_type}} | {{c|std::iterator_traits<BidirectionalIterator>::difference_type}}}}
{{tdcl list item | {{tt|size_type}} | {{c|std::allocator_traits<Allocator>::size_type}}}}
+
{{list item | {{tt|size_type}} | {{c|std::allocator_traits<Allocator>::size_type}}}}
{{tdcl list item | {{tt|char_type}} | {{c|std::iterator_traits<BidirectionalIterator>::value_type}}}}
+
{{list item | {{tt|char_type}} | {{c|std::iterator_traits<BidirectionalIterator>::value_type}}}}
{{tdcl list item | {{tt|string_type}} | {{c|std::basic_string<char_type>}}}}
+
{{list item | {{tt|string_type}} | {{c|std::basic_string<char_type>}}}}
 
{{dcl list end}}
 
{{dcl list end}}
  

Revision as of 02:40, 12 June 2012

Template:cpp/regex/match results/sidebar

Defined in header <regex>
template<

    class BidirectionalIterator,
    class Allocator = std::allocator<std::sub_match<BidirectionalIterator>>

> class match_results;
(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

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>

Member functions

Template:cpp/regex/match results/dcl list constructorTemplate:cpp/regex/match results/dcl list destructorTemplate:cpp/regex/match results/dcl list operator=Template:cpp/regex/match results/dcl list get allocatorTemplate:cpp/regex/match results/dcl list emptyTemplate:cpp/regex/match results/dcl list sizeTemplate:cpp/regex/match results/dcl list max sizeTemplate:cpp/regex/match results/dcl list lengthTemplate:cpp/regex/match results/dcl list positionTemplate:cpp/regex/match results/dcl list strTemplate:cpp/regex/match results/dcl list operator atTemplate:cpp/regex/match results/dcl list prefixTemplate:cpp/regex/match results/dcl list suffixTemplate:cpp/regex/match results/dcl list beginTemplate:cpp/regex/match results/dcl list endTemplate:cpp/regex/match results/dcl list formatTemplate:cpp/regex/match results/dcl list swap
State

(public member function)
Size
Element access
Iterators
Format
Modifiers

Non-member functions

lexicographically compares the values in the two match result
(function template)
specializes the Template:cpp/ltf algorithm
(function template)