We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

regex_iterator Class

Iterator class for matches.

template<class BidIt, class Elem = iterator_traits<BidIt>::value_type,
    class RXtraits = regex_traits<Elem> >
        class regex_iterator {
    typedef basic_regex<Elem, RXtraits> regex_type;
    typedef match_results<BidIt> value_type;
    typedef std::forward_iterator_tag iterator_category;
    typedef std::ptrdiff_t difference_type;
    typedef const match_results<BidIt>* pointer;
    typedef const match_results<BidIt>& reference;

    regex_iterator(BidIt first, BidIt last,
        const regex_type& re,
        regex_constants::match_flag_type f = regex_constants::match_default);

    bool operator==(const regex_iterator& right);
    bool operator!=(const regex_iterator& right);
    const match_results<BidIt>& operator*();
    const match_results<BidIt> *operator->();
    regex_iterator& operator++();
    regex_iterator& operator++(int);

    BidIt begin;                            // exposition only
    BidIt end;                              // exposition only
    regex_type *pregex;                     // exposition only
    regex_constants::match_flag_type flags; // exposition only
    match_results<BidIt> match;             // exposition only


The iterator type for submatches.


The type of elements to match.


Traits class for elements.

The template class describes a constant forward iterator object. It extracts objects of type match_results<BidIt> by repeatedly applying its regular expression object *pregex to the character sequence defined by the iterator range [begin, end).

See the following topics for examples on regular expressions:

Header: <regex>

Namespace: std