[re.tokiter.cnstr]

# 28 Text processing library [[text]](./#text)

## 28.6 Regular expressions library [[re]](re#tokiter.cnstr)

### 28.6.11 Regular expression iterators [[re.iter]](re.iter#re.tokiter.cnstr)

#### 28.6.11.2 Class template regex_token_iterator [[re.tokiter]](re.tokiter#cnstr)

#### 28.6.11.2.2 Constructors [re.tokiter.cnstr]

[ð](#lib:regex_token_iterator,constructor)

`regex_token_iterator();
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12631)

*Effects*: Constructs the end-of-sequence iterator[.](#1.sentence-1)

[ð](#lib:regex_token_iterator,constructor_)

`regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
                     const regex_type& re,
                     int submatch = 0,
                     regex_constants::match_flag_type m = regex_constants::match_default);

regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
                     const regex_type& re,
                     const vector<int>& submatches,
                     regex_constants::match_flag_type m = regex_constants::match_default);

regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
                     const regex_type& re,
                     initializer_list<int> submatches,
                     regex_constants::match_flag_type m = regex_constants::match_default);

template<size_t N>
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
                       const regex_type& re,
                       const int (&submatches)[N],
                       regex_constants::match_flag_type m = regex_constants::match_default);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12661)

*Preconditions*: Each of the initialization values of submatches is >= -1[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12665)

*Effects*: The first constructor initializes the member subs to hold the single
value submatch[.](#3.sentence-1)

The second, third, and fourth constructors
initialize the member subs to hold a copy of the sequence of integer values
pointed to by the iterator range
[begin(submatches), end(submatches))[.](#3.sentence-2)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12674)

Each constructor then sets N to 0, and position toposition_iterator(a, b, re, m)[.](#4.sentence-1)

If position is not an
end-of-sequence iterator the constructor sets result to the
address of the current match[.](#4.sentence-2)

Otherwise if any of the values stored
in subs is equal to â1 the constructor sets *this to a suffix
iterator that points to the range [a, b), otherwise the constructor
sets *this to an end-of-sequence iterator[.](#4.sentence-3)
