[re.results.acc]

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

## 28.6 Regular expressions library [[re]](re#results.acc)

### 28.6.9 Class template match_results [[re.results]](re.results#acc)

#### 28.6.9.5 Element access [re.results.acc]

[ð](#lib:length,match_results)

`difference_type length(size_type sub = 0) const;
`

[1](#1)

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

*Preconditions*: ready() == true[.](#1.sentence-1)

[2](#2)

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

*Returns*: (*this)[sub].length()[.](#2.sentence-1)

[ð](#lib:position,match_results)

`difference_type position(size_type sub = 0) const;
`

[3](#3)

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

*Preconditions*: ready() == true[.](#3.sentence-1)

[4](#4)

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

*Returns*: The distance from the start of the target sequence
to (*this)[sub].first[.](#4.sentence-1)

[ð](#lib:match_results,str)

`string_type str(size_type sub = 0) const;
`

[5](#5)

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

*Preconditions*: ready() == true[.](#5.sentence-1)

[6](#6)

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

*Returns*: string_type((*this)[sub])[.](#6.sentence-1)

[ð](#lib:match_results,operator%5b%5d)

`const_reference operator[](size_type n) const;
`

[7](#7)

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

*Preconditions*: ready() == true[.](#7.sentence-1)

[8](#8)

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

*Returns*: A reference to the sub_match object representing the
character sequence that matched marked sub-expression n[.](#8.sentence-1)

If n == 0 then returns a reference to a sub_match object representing the
character sequence that matched the whole regular expression[.](#8.sentence-2)

Ifn >= size() then returns a sub_match object representing an
unmatched sub-expression[.](#8.sentence-3)

[ð](#lib:match_results,prefix)

`const_reference prefix() const;
`

[9](#9)

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

*Preconditions*: ready() == true[.](#9.sentence-1)

[10](#10)

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

*Returns*: A reference to the sub_match object representing the
character sequence from the start of the string being
matched/searched to the start of the match found[.](#10.sentence-1)

[ð](#lib:match_results,suffix)

`const_reference suffix() const;
`

[11](#11)

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

*Preconditions*: ready() == true[.](#11.sentence-1)

[12](#12)

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

*Returns*: A reference to the sub_match object representing the
character sequence from the end of the match found to the end of the
string being matched/searched[.](#12.sentence-1)

[ð](#lib:match_results,begin)

`const_iterator begin() const;
const_iterator cbegin() const;
`

[13](#13)

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

*Returns*: A starting iterator that enumerates over all the
sub-expressions stored in *this[.](#13.sentence-1)

[ð](#lib:match_results,end)

`const_iterator end() const;
const_iterator cend() const;
`

[14](#14)

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

*Returns*: A terminating iterator that enumerates over all the
sub-expressions stored in *this[.](#14.sentence-1)
