From Jason Turner

[re.alg]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpqmielaj4/{from.md → to.md} +69 -72
tmp/tmpqmielaj4/{from.md → to.md} RENAMED
@@ -1,8 +1,8 @@
1
  ## Regular expression algorithms <a id="re.alg">[[re.alg]]</a>
2
 
3
- ### exceptions <a id="re.except">[[re.except]]</a>
4
 
5
  The algorithms described in this subclause may throw an exception of
6
  type `regex_error`. If such an exception `e` is thrown, `e.code()` shall
7
  return either `regex_constants::error_complexity` or
8
  `regex_constants::error_stack`.
@@ -12,23 +12,35 @@ return either `regex_constants::error_complexity` or
12
  ``` cpp
13
  template <class BidirectionalIterator, class Allocator, class charT, class traits>
14
  bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
15
  match_results<BidirectionalIterator, Allocator>& m,
16
  const basic_regex<charT, traits>& e,
17
- regex_constants::match_flag_type flags =
18
- regex_constants::match_default);
19
  ```
20
 
21
  *Requires:* The type `BidirectionalIterator` shall satisfy the
22
- requirements of a Bidirectional Iterator
23
-  ([[bidirectional.iterators]]).
24
 
25
  *Effects:* Determines whether there is a match between the regular
26
  expression `e`, and all of the character sequence \[`first`, `last`).
27
  The parameter `flags` is used to control how the expression is matched
28
- against the character sequence. Returns `true` if such a match exists,
29
- `false` otherwise.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  *Postconditions:* `m.ready() == true` in all cases. If the function
32
  returns `false`, then the effect on parameter `m` is unspecified except
33
  that `m.size()` returns `0` and `m.empty()` returns `true`. Otherwise
34
  the effects on parameter `m` are given in Table  [[tab:re:alg:match]].
@@ -36,30 +48,29 @@ the effects on parameter `m` are given in Table  [[tab:re:alg:match]].
36
  **Table: Effects of `regex_match` algorithm** <a id="tab:re:alg:match">[tab:re:alg:match]</a>
37
 
38
  | Element | Value |
39
  | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
40
  | `m.size()` | `1 + e.mark_count()` |
41
- | `m.empty()` | false |
42
- | `m.prefix().first` | first |
43
- | `m.prefix().second` | first |
44
- | `m.prefix().matched` | false |
45
- | `m.suffix().first` | last |
46
- | `m.suffix().second` | last |
47
- | `m.suffix().matched` | false |
48
- | `m[0].first` | first |
49
- | `m[0].second` | last |
50
  | `m[0].matched` | `true` |
51
  | `m[n].first` | For all integers `0 < n < m.size()`, the start of the sequence that matched sub-expression `n`. Alternatively, if sub-expression `n` did not participate in the match, then `last`. |
52
  | `m[n].second` | For all integers `0 < n < m.size()`, the end of the sequence that matched sub-expression `n`. Alternatively, if sub-expression `n` did not participate in the match, then `last`. |
53
  | `m[n].matched` | For all integers `0 < n < m.size()`, `true` if sub-expression `n` participated in the match, `false` otherwise. |
54
 
55
  ``` cpp
56
  template <class BidirectionalIterator, class charT, class traits>
57
  bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
58
  const basic_regex<charT, traits>& e,
59
- regex_constants::match_flag_type flags =
60
- regex_constants::match_default);
61
  ```
62
 
63
  *Effects:* Behaves “as if” by constructing an instance of
64
  `match_results<BidirectionalIterator> what`, and then returning the
65
  result of `regex_match(first, last, what, e, flags)`.
@@ -67,47 +78,42 @@ result of `regex_match(first, last, what, e, flags)`.
67
  ``` cpp
68
  template <class charT, class Allocator, class traits>
69
  bool regex_match(const charT* str,
70
  match_results<const charT*, Allocator>& m,
71
  const basic_regex<charT, traits>& e,
72
- regex_constants::match_flag_type flags =
73
- regex_constants::match_default);
74
  ```
75
 
76
  *Returns:*
77
  `regex_match(str, str + char_traits<charT>::length(str), m, e, flags)`.
78
 
79
  ``` cpp
80
  template <class ST, class SA, class Allocator, class charT, class traits>
81
  bool regex_match(const basic_string<charT, ST, SA>& s,
82
- match_results<
83
- typename basic_string<charT, ST, SA>::const_iterator,
84
  Allocator>& m,
85
  const basic_regex<charT, traits>& e,
86
- regex_constants::match_flag_type flags =
87
- regex_constants::match_default);
88
  ```
89
 
90
  *Returns:* `regex_match(s.begin(), s.end(), m, e, flags)`.
91
 
92
  ``` cpp
93
  template <class charT, class traits>
94
  bool regex_match(const charT* str,
95
  const basic_regex<charT, traits>& e,
96
- regex_constants::match_flag_type flags =
97
- regex_constants::match_default);
98
  ```
99
 
100
  *Returns:*
101
  `regex_match(str, str + char_traits<charT>::length(str), e, flags)`
102
 
103
  ``` cpp
104
  template <class ST, class SA, class charT, class traits>
105
  bool regex_match(const basic_string<charT, ST, SA>& s,
106
  const basic_regex<charT, traits>& e,
107
- regex_constants::match_flag_type flags =
108
- regex_constants::match_default);
109
  ```
110
 
111
  *Returns:* `regex_match(s.begin(), s.end(), e, flags)`.
112
 
113
  ### `regex_search` <a id="re.alg.search">[[re.alg.search]]</a>
@@ -115,12 +121,11 @@ template <class ST, class SA, class charT, class traits>
115
  ``` cpp
116
  template <class BidirectionalIterator, class Allocator, class charT, class traits>
117
  bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
118
  match_results<BidirectionalIterator, Allocator>& m,
119
  const basic_regex<charT, traits>& e,
120
- regex_constants::match_flag_type flags =
121
- regex_constants::match_default);
122
  ```
123
 
124
  *Requires:* Type `BidirectionalIterator` shall satisfy the requirements
125
  of a Bidirectional Iterator ([[bidirectional.iterators]]).
126
 
@@ -156,60 +161,53 @@ the effects on parameter `m` are given in Table  [[tab:re:alg:search]].
156
 
157
  ``` cpp
158
  template <class charT, class Allocator, class traits>
159
  bool regex_search(const charT* str, match_results<const charT*, Allocator>& m,
160
  const basic_regex<charT, traits>& e,
161
- regex_constants::match_flag_type flags =
162
- regex_constants::match_default);
163
  ```
164
 
165
- *Returns:* The result of
166
  `regex_search(str, str + char_traits<charT>::length(str), m, e, flags)`.
167
 
168
  ``` cpp
169
  template <class ST, class SA, class Allocator, class charT, class traits>
170
  bool regex_search(const basic_string<charT, ST, SA>& s,
171
- match_results<
172
- typename basic_string<charT, ST, SA>::const_iterator,
173
  Allocator>& m,
174
  const basic_regex<charT, traits>& e,
175
- regex_constants::match_flag_type flags =
176
- regex_constants::match_default);
177
  ```
178
 
179
- *Returns:* The result of
180
- `regex_search(s.begin(), s.end(), m, e, flags)`.
181
 
182
  ``` cpp
183
  template <class BidirectionalIterator, class charT, class traits>
184
  bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
185
  const basic_regex<charT, traits>& e,
186
- regex_constants::match_flag_type flags =
187
- regex_constants::match_default);
188
  ```
189
 
190
  *Effects:* Behaves “as if” by constructing an object `what` of type
191
- `match_results<BidirectionalIterator>` and then returning the result of
192
  `regex_search(first, last, what, e, flags)`.
193
 
194
  ``` cpp
195
  template <class charT, class traits>
196
  bool regex_search(const charT* str,
197
  const basic_regex<charT, traits>& e,
198
- regex_constants::match_flag_type flags =
199
- regex_constants::match_default);
200
  ```
201
 
202
  *Returns:*
203
- `regex_search(str, str + char_traits<charT>::length(str), e, flags)`
204
 
205
  ``` cpp
206
  template <class ST, class SA, class charT, class traits>
207
  bool regex_search(const basic_string<charT, ST, SA>& s,
208
  const basic_regex<charT, traits>& e,
209
- regex_constants::match_flag_type flags =
210
- regex_constants::match_default);
211
  ```
212
 
213
  *Returns:* `regex_search(s.begin(), s.end(), e, flags)`.
214
 
215
  ### `regex_replace` <a id="re.alg.replace">[[re.alg.replace]]</a>
@@ -220,21 +218,18 @@ template <class OutputIterator, class BidirectionalIterator,
220
  OutputIterator
221
  regex_replace(OutputIterator out,
222
  BidirectionalIterator first, BidirectionalIterator last,
223
  const basic_regex<charT, traits>& e,
224
  const basic_string<charT, ST, SA>& fmt,
225
- regex_constants::match_flag_type flags =
226
- regex_constants::match_default);
227
- template <class OutputIterator, class BidirectionalIterator,
228
- class traits, class charT>
229
  OutputIterator
230
  regex_replace(OutputIterator out,
231
  BidirectionalIterator first, BidirectionalIterator last,
232
  const basic_regex<charT, traits>& e,
233
  const charT* fmt,
234
- regex_constants::match_flag_type flags =
235
- regex_constants::match_default);
236
  ```
237
 
238
  *Effects:* Constructs a `regex_iterator` object `i` as if by
239
 
240
  ``` cpp
@@ -242,21 +237,21 @@ regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags)
242
  ```
243
 
244
  and uses `i` to enumerate through all of the matches `m` of type
245
  `match_results<BidirectionalIterator>` that occur within the sequence
246
  \[`first`, `last`). If no such matches are found and
247
- `!(flags & regex_constants::format_no_copy)` then calls
248
 
249
  ``` cpp
250
- out = std::copy(first, last, out)
251
  ```
252
 
253
  If any matches are found then, for each such match:
254
 
255
  - If `!(flags & regex_constants::format_no_copy)`, calls
256
  ``` cpp
257
- out = std::copy(m.prefix().first, m.prefix().second, out)
258
  ```
259
  - Then calls
260
  ``` cpp
261
  out = m.format(out, fmt, flags)
262
  ```
@@ -270,60 +265,62 @@ If any matches are found then, for each such match:
270
 
271
  Finally, if such a match is found and
272
  `!(flags & regex_constants::format_no_copy)`, calls
273
 
274
  ``` cpp
275
- out = std::copy(last_m.suffix().first, last_m.suffix().second, out)
276
  ```
277
 
278
  where `last_m` is a copy of the last match found. If
279
- `flags & regex_constants::format_first_only` is non-zero then only the
280
  first match found is replaced.
281
 
282
  *Returns:* `out`.
283
 
284
  ``` cpp
285
  template <class traits, class charT, class ST, class SA, class FST, class FSA>
286
  basic_string<charT, ST, SA>
287
  regex_replace(const basic_string<charT, ST, SA>& s,
288
  const basic_regex<charT, traits>& e,
289
  const basic_string<charT, FST, FSA>& fmt,
290
- regex_constants::match_flag_type flags =
291
- regex_constants::match_default);
292
  template <class traits, class charT, class ST, class SA>
293
  basic_string<charT, ST, SA>
294
  regex_replace(const basic_string<charT, ST, SA>& s,
295
  const basic_regex<charT, traits>& e,
296
  const charT* fmt,
297
- regex_constants::match_flag_type flags =
298
- regex_constants::match_default);
299
  ```
300
 
301
  *Effects:* Constructs an empty string `result` of type
302
- `basic_string<charT, ST, SA>` and calls
303
- `regex_replace(back_inserter(result), s.begin(), s.end(), e, fmt, flags)`.
304
 
305
- *Returns:*  `result`.
 
 
 
 
306
 
307
  ``` cpp
308
  template <class traits, class charT, class ST, class SA>
309
  basic_string<charT>
310
  regex_replace(const charT* s,
311
  const basic_regex<charT, traits>& e,
312
  const basic_string<charT, ST, SA>& fmt,
313
- regex_constants::match_flag_type flags =
314
- regex_constants::match_default);
315
  template <class traits, class charT>
316
  basic_string<charT>
317
  regex_replace(const charT* s,
318
  const basic_regex<charT, traits>& e,
319
  const charT* fmt,
320
- regex_constants::match_flag_type flags =
321
- regex_constants::match_default);
322
  ```
323
 
324
  *Effects:* Constructs an empty string `result` of type
325
- `basic_string<charT>` and calls `regex_replace(`
326
- `back_inserter(result), s, s + char_traits<charT>::length(s), e, fmt, flags)`.
327
 
328
- *Returns:*  `result`.
 
 
 
 
329
 
 
1
  ## Regular expression algorithms <a id="re.alg">[[re.alg]]</a>
2
 
3
+ ### Exceptions <a id="re.except">[[re.except]]</a>
4
 
5
  The algorithms described in this subclause may throw an exception of
6
  type `regex_error`. If such an exception `e` is thrown, `e.code()` shall
7
  return either `regex_constants::error_complexity` or
8
  `regex_constants::error_stack`.
 
12
  ``` cpp
13
  template <class BidirectionalIterator, class Allocator, class charT, class traits>
14
  bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
15
  match_results<BidirectionalIterator, Allocator>& m,
16
  const basic_regex<charT, traits>& e,
17
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
18
  ```
19
 
20
  *Requires:* The type `BidirectionalIterator` shall satisfy the
21
+ requirements of a Bidirectional Iterator ([[bidirectional.iterators]]).
 
22
 
23
  *Effects:* Determines whether there is a match between the regular
24
  expression `e`, and all of the character sequence \[`first`, `last`).
25
  The parameter `flags` is used to control how the expression is matched
26
+ against the character sequence. When determining if there is a match,
27
+ only potential matches that match the entire character sequence are
28
+ considered. Returns `true` if such a match exists, `false` otherwise.
29
+
30
+ [*Example 1*:
31
+
32
+ ``` cpp
33
+ std::regex re("Get|GetValue");
34
+ std::cmatch m;
35
+ regex_search("GetValue", m, re); // returns true, and m[0] contains "Get"
36
+ regex_match ("GetValue", m, re); // returns true, and m[0] contains "GetValue"
37
+ regex_search("GetValues", m, re); // returns true, and m[0] contains "Get"
38
+ regex_match ("GetValues", m, re); // returns false
39
+ ```
40
+
41
+ — *end example*]
42
 
43
  *Postconditions:* `m.ready() == true` in all cases. If the function
44
  returns `false`, then the effect on parameter `m` is unspecified except
45
  that `m.size()` returns `0` and `m.empty()` returns `true`. Otherwise
46
  the effects on parameter `m` are given in Table  [[tab:re:alg:match]].
 
48
  **Table: Effects of `regex_match` algorithm** <a id="tab:re:alg:match">[tab:re:alg:match]</a>
49
 
50
  | Element | Value |
51
  | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
  | `m.size()` | `1 + e.mark_count()` |
53
+ | `m.empty()` | `false` |
54
+ | `m.prefix().first` | `first` |
55
+ | `m.prefix().second` | `first` |
56
+ | `m.prefix().matched` | `false` |
57
+ | `m.suffix().first` | `last` |
58
+ | `m.suffix().second` | `last` |
59
+ | `m.suffix().matched` | `false` |
60
+ | `m[0].first` | `first` |
61
+ | `m[0].second` | `last` |
62
  | `m[0].matched` | `true` |
63
  | `m[n].first` | For all integers `0 < n < m.size()`, the start of the sequence that matched sub-expression `n`. Alternatively, if sub-expression `n` did not participate in the match, then `last`. |
64
  | `m[n].second` | For all integers `0 < n < m.size()`, the end of the sequence that matched sub-expression `n`. Alternatively, if sub-expression `n` did not participate in the match, then `last`. |
65
  | `m[n].matched` | For all integers `0 < n < m.size()`, `true` if sub-expression `n` participated in the match, `false` otherwise. |
66
 
67
  ``` cpp
68
  template <class BidirectionalIterator, class charT, class traits>
69
  bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
70
  const basic_regex<charT, traits>& e,
71
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
72
  ```
73
 
74
  *Effects:* Behaves “as if” by constructing an instance of
75
  `match_results<BidirectionalIterator> what`, and then returning the
76
  result of `regex_match(first, last, what, e, flags)`.
 
78
  ``` cpp
79
  template <class charT, class Allocator, class traits>
80
  bool regex_match(const charT* str,
81
  match_results<const charT*, Allocator>& m,
82
  const basic_regex<charT, traits>& e,
83
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
84
  ```
85
 
86
  *Returns:*
87
  `regex_match(str, str + char_traits<charT>::length(str), m, e, flags)`.
88
 
89
  ``` cpp
90
  template <class ST, class SA, class Allocator, class charT, class traits>
91
  bool regex_match(const basic_string<charT, ST, SA>& s,
92
+ match_results<typename basic_string<charT, ST, SA>::const_iterator,
 
93
  Allocator>& m,
94
  const basic_regex<charT, traits>& e,
95
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
96
  ```
97
 
98
  *Returns:* `regex_match(s.begin(), s.end(), m, e, flags)`.
99
 
100
  ``` cpp
101
  template <class charT, class traits>
102
  bool regex_match(const charT* str,
103
  const basic_regex<charT, traits>& e,
104
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
105
  ```
106
 
107
  *Returns:*
108
  `regex_match(str, str + char_traits<charT>::length(str), e, flags)`
109
 
110
  ``` cpp
111
  template <class ST, class SA, class charT, class traits>
112
  bool regex_match(const basic_string<charT, ST, SA>& s,
113
  const basic_regex<charT, traits>& e,
114
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
115
  ```
116
 
117
  *Returns:* `regex_match(s.begin(), s.end(), e, flags)`.
118
 
119
  ### `regex_search` <a id="re.alg.search">[[re.alg.search]]</a>
 
121
  ``` cpp
122
  template <class BidirectionalIterator, class Allocator, class charT, class traits>
123
  bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
124
  match_results<BidirectionalIterator, Allocator>& m,
125
  const basic_regex<charT, traits>& e,
126
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
127
  ```
128
 
129
  *Requires:* Type `BidirectionalIterator` shall satisfy the requirements
130
  of a Bidirectional Iterator ([[bidirectional.iterators]]).
131
 
 
161
 
162
  ``` cpp
163
  template <class charT, class Allocator, class traits>
164
  bool regex_search(const charT* str, match_results<const charT*, Allocator>& m,
165
  const basic_regex<charT, traits>& e,
166
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
167
  ```
168
 
169
+ *Returns:*
170
  `regex_search(str, str + char_traits<charT>::length(str), m, e, flags)`.
171
 
172
  ``` cpp
173
  template <class ST, class SA, class Allocator, class charT, class traits>
174
  bool regex_search(const basic_string<charT, ST, SA>& s,
175
+ match_results<typename basic_string<charT, ST, SA>::const_iterator,
 
176
  Allocator>& m,
177
  const basic_regex<charT, traits>& e,
178
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
179
  ```
180
 
181
+ *Returns:* `regex_search(s.begin(), s.end(), m, e, flags)`.
 
182
 
183
  ``` cpp
184
  template <class BidirectionalIterator, class charT, class traits>
185
  bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
186
  const basic_regex<charT, traits>& e,
187
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
188
  ```
189
 
190
  *Effects:* Behaves “as if” by constructing an object `what` of type
191
+ `match_results<BidirectionalIterator>` and returning
192
  `regex_search(first, last, what, e, flags)`.
193
 
194
  ``` cpp
195
  template <class charT, class traits>
196
  bool regex_search(const charT* str,
197
  const basic_regex<charT, traits>& e,
198
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
199
  ```
200
 
201
  *Returns:*
202
+ `regex_search(str, str + char_traits<charT>::length(str), e, flags)`.
203
 
204
  ``` cpp
205
  template <class ST, class SA, class charT, class traits>
206
  bool regex_search(const basic_string<charT, ST, SA>& s,
207
  const basic_regex<charT, traits>& e,
208
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
209
  ```
210
 
211
  *Returns:* `regex_search(s.begin(), s.end(), e, flags)`.
212
 
213
  ### `regex_replace` <a id="re.alg.replace">[[re.alg.replace]]</a>
 
218
  OutputIterator
219
  regex_replace(OutputIterator out,
220
  BidirectionalIterator first, BidirectionalIterator last,
221
  const basic_regex<charT, traits>& e,
222
  const basic_string<charT, ST, SA>& fmt,
223
+ regex_constants::match_flag_type flags = regex_constants::match_default);
224
+ template <class OutputIterator, class BidirectionalIterator, class traits, class charT>
 
 
225
  OutputIterator
226
  regex_replace(OutputIterator out,
227
  BidirectionalIterator first, BidirectionalIterator last,
228
  const basic_regex<charT, traits>& e,
229
  const charT* fmt,
230
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
231
  ```
232
 
233
  *Effects:* Constructs a `regex_iterator` object `i` as if by
234
 
235
  ``` cpp
 
237
  ```
238
 
239
  and uses `i` to enumerate through all of the matches `m` of type
240
  `match_results<BidirectionalIterator>` that occur within the sequence
241
  \[`first`, `last`). If no such matches are found and
242
+ `!(flags & regex_constants::format_no_copy)`, then calls
243
 
244
  ``` cpp
245
+ out = copy(first, last, out)
246
  ```
247
 
248
  If any matches are found then, for each such match:
249
 
250
  - If `!(flags & regex_constants::format_no_copy)`, calls
251
  ``` cpp
252
+ out = copy(m.prefix().first, m.prefix().second, out)
253
  ```
254
  - Then calls
255
  ``` cpp
256
  out = m.format(out, fmt, flags)
257
  ```
 
265
 
266
  Finally, if such a match is found and
267
  `!(flags & regex_constants::format_no_copy)`, calls
268
 
269
  ``` cpp
270
+ out = copy(last_m.suffix().first, last_m.suffix().second, out)
271
  ```
272
 
273
  where `last_m` is a copy of the last match found. If
274
+ `flags & regex_constants::format_first_only` is nonzero, then only the
275
  first match found is replaced.
276
 
277
  *Returns:* `out`.
278
 
279
  ``` cpp
280
  template <class traits, class charT, class ST, class SA, class FST, class FSA>
281
  basic_string<charT, ST, SA>
282
  regex_replace(const basic_string<charT, ST, SA>& s,
283
  const basic_regex<charT, traits>& e,
284
  const basic_string<charT, FST, FSA>& fmt,
285
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
286
  template <class traits, class charT, class ST, class SA>
287
  basic_string<charT, ST, SA>
288
  regex_replace(const basic_string<charT, ST, SA>& s,
289
  const basic_regex<charT, traits>& e,
290
  const charT* fmt,
291
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
292
  ```
293
 
294
  *Effects:* Constructs an empty string `result` of type
295
+ `basic_string<charT, ST, SA>` and calls:
 
296
 
297
+ ``` cpp
298
+ regex_replace(back_inserter(result), s.begin(), s.end(), e, fmt, flags);
299
+ ```
300
+
301
+ *Returns:* `result`.
302
 
303
  ``` cpp
304
  template <class traits, class charT, class ST, class SA>
305
  basic_string<charT>
306
  regex_replace(const charT* s,
307
  const basic_regex<charT, traits>& e,
308
  const basic_string<charT, ST, SA>& fmt,
309
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
310
  template <class traits, class charT>
311
  basic_string<charT>
312
  regex_replace(const charT* s,
313
  const basic_regex<charT, traits>& e,
314
  const charT* fmt,
315
+ regex_constants::match_flag_type flags = regex_constants::match_default);
 
316
  ```
317
 
318
  *Effects:* Constructs an empty string `result` of type
319
+ `basic_string<charT>` and calls:
 
320
 
321
+ ``` cpp
322
+ regex_replace(back_inserter(result), s, s + char_traits<charT>::length(s), e, fmt, flags);
323
+ ```
324
+
325
+ *Returns:* `result`.
326