Namespaces
Variants
Views
Actions

std::match_results

From cppreference.com
< cpp‎ | regex
Revision as of 02:40, 12 June 2012 by P12bot (Talk | contribs)

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 at
State

(public member function)
Size
Element access