[re.results.form]

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

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

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

#### 28.6.9.6 Formatting [re.results.form]

[ð](#lib:match_results,format)

`template<class OutputIter>
  OutputIter format(
    OutputIter out,
    const char_type* fmt_first, const char_type* fmt_last,
    regex_constants::match_flag_type flags = regex_constants::format_default) const;
`

[1](#1)

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

*Preconditions*: ready() == true and OutputIter meets the requirements for a*Cpp17OutputIterator* ([[output.iterators]](output.iterators "24.3.5.4 Output iterators"))[.](#1.sentence-1)

[2](#2)

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

*Effects*: Copies the character sequence [fmt_first, fmt_last) to
OutputIter out[.](#2.sentence-1)

Replaces each format specifier or escape
sequence in the copied range with either the character(s) it represents or
the sequence of characters within *this to which it refers[.](#2.sentence-2)

The bitmasks specified in flags determine which format
specifiers and escape sequences are recognized[.](#2.sentence-3)

[3](#3)

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

*Returns*: out[.](#3.sentence-1)

[ð](#lib:match_results,format_)

`template<class OutputIter, class ST, class SA>
  OutputIter format(
    OutputIter out,
    const basic_string<char_type, ST, SA>& fmt,
    regex_constants::match_flag_type flags = regex_constants::format_default) const;
`

[4](#4)

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

*Effects*: Equivalent to:return format(out, fmt.data(), fmt.data() + fmt.size(), flags);

[ð](#lib:match_results,format__)

`template<class ST, class SA>
  basic_string<char_type, ST, SA> format(
    const basic_string<char_type, ST, SA>& fmt,
    regex_constants::match_flag_type flags = regex_constants::format_default) const;
`

[5](#5)

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

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

[6](#6)

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

*Effects*: Constructs an empty string result of type basic_string<char_type, ST, SA> and
calls:format(back_inserter(result), fmt, flags);

[7](#7)

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

*Returns*: result[.](#7.sentence-1)

[ð](#lib:match_results,format___)

`string_type format(
  const char_type* fmt,
  regex_constants::match_flag_type flags = regex_constants::format_default) const;
`

[8](#8)

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

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

[9](#9)

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

*Effects*: Constructs an empty string result of type string_type and
calls:format(back_inserter(result), fmt, fmt + char_traits<char_type>::length(fmt), flags);

[10](#10)

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

*Returns*: result[.](#10.sentence-1)
