[re.regiter.incr]

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

## 28.6 Regular expressions library [[re]](re#regiter.incr)

### 28.6.11 Regular expression iterators [[re.iter]](re.iter#re.regiter.incr)

#### 28.6.11.1 Class template regex_iterator [[re.regiter]](re.regiter#incr)

#### 28.6.11.1.5 Increment [re.regiter.incr]

[ð](#lib:regex_iterator,operator++)

`regex_iterator& operator++();
`

[1](#1)

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

*Effects*: Constructs a local variable start of type BidirectionalIterator and
initializes it with the value of match[0].second[.](#1.sentence-1)

[2](#2)

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

If the iterator holds a zero-length match and start == end the operator
sets *this to the end-of-sequence iterator and returns *this[.](#2.sentence-1)

[3](#3)

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

Otherwise, if the iterator holds a zero-length match, the operator calls:regex_search(start, end, match, *pregex,
 flags | regex_constants::match_not_null | regex_constants::match_continuous)

If the call returns true the operator
returns *this[.](#3.sentence-2)

Otherwise the operator increments start and continues as if
the most recent match was not a zero-length match[.](#3.sentence-3)

[4](#4)

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

If the most recent match was not a zero-length match, the operator setsflags to flags | regex_constants​::​match_prev_avail and
calls regex_search(start, end, match, *pregex, flags)[.](#4.sentence-1)

If the call returnsfalse the iterator sets *this to the end-of-sequence iterator[.](#4.sentence-2)

The
iterator then returns *this[.](#4.sentence-3)

[5](#5)

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

In all cases in which the call to regex_search returns true,match.prefix().first shall be equal to the previous value ofmatch[0].second, and for each index i in the half-open range
[0, match.size()) for which match[i].matched is true,match.position(i) shall return distance(begin, match[i].​first)[.](#5.sentence-1)

[6](#6)

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

[*Note [1](#note-1)*:

This means that match.position(i) gives the
offset from the beginning of the target sequence, which is often not
the same as the offset from the sequence passed in the call
to regex_search[.](#6.sentence-1)

â *end note*]

[7](#7)

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

It is unspecified how the implementation makes these adjustments[.](#7.sentence-1)

[8](#8)

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

[*Note [2](#note-2)*:

This means that an implementation can call an
implementation-specific search function, in which case a program-defined
specialization of regex_search will not be
called[.](#8.sentence-1)

â *end note*]

[ð](#lib:regex_iterator,operator++_)

`regex_iterator operator++(int);
`

[9](#9)

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

*Effects*: As if by:regex_iterator tmp = *this;++(*this);return tmp;
