From Jason Turner

[re.alg]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpezdbqpzy/{from.md → to.md} +46 -22
tmp/tmpezdbqpzy/{from.md → to.md} RENAMED
@@ -34,25 +34,25 @@ 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]].
35
 
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` if a full match was found. |
51
- | `m[n].first` | For all integers `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 `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 `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,
@@ -136,25 +136,25 @@ that `m.size()` returns `0` and `m.empty()` returns `true`. Otherwise
136
  the effects on parameter `m` are given in Table  [[tab:re:alg:search]].
137
 
138
  **Table: Effects of `regex_search` algorithm** <a id="tab:re:alg:search">[tab:re:alg:search]</a>
139
 
140
  | Element | Value |
141
- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
142
  | `m.size()` | `1 + e.mark_count()` |
143
  | `m.empty()` | `false` |
144
  | `m.prefix().first` | `first` |
145
  | `m.prefix().second` | `m[0].first` |
146
  | `m.prefix().matched` | `m.prefix().first != m.prefix().second` |
147
  | `m.suffix().first` | `m[0].second` |
148
  | `m.suffix().second` | `last` |
149
  | `m.suffix().matched` | `m.suffix().first != m.suffix().second` |
150
  | `m[0].first` | The start of the sequence of characters that matched the regular expression |
151
  | `m[0].second` | The end of the sequence of characters that matched the regular expression |
152
- | `m[0].matched` | `true` if a match was found, and `false` otherwise. |
153
- | `m[n].first` | For all integers `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`. |
154
- | `m[n].second` | For all integers `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` . |
155
- | `m[n].matched` | For all integers `n < m.size()`, `true` if sub-expression `n` participated in the match, `false` otherwise. |
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,
@@ -234,26 +234,50 @@ template <class OutputIterator, class BidirectionalIterator,
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
- `regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags)`,
 
 
 
 
240
  and uses `i` to enumerate through all of the matches `m` of type
241
  `match_results<BidirectionalIterator>` that occur within the sequence
242
  \[`first`, `last`). If no such matches are found and
243
- `!(flags & regex_constants ``format_no_copy)` then calls
244
- `std::copy(first, last, out)`. If any matches are found then, for each
245
- such match, if `!(flags & regex_constants::format_no_copy)`, calls
246
- `std::copy(m.prefix().first, m.prefix().second, out)`, and then calls
247
- `m.format(out, fmt, flags)` for the first form of the function and
248
- `m.format(out,` `fmt, fmt + char_traits<charT>::length(fmt), flags)` for
249
- the second.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
 
251
  Finally, if such a match is found and
252
- `!(flags & regex_constants ``format_no_copy)`, calls
253
- `std::copy(last_m.suffix().first, last_m.suffix().second, out)` where
254
- `last_m` is a copy of the last match found. If
 
 
 
 
255
  `flags & regex_constants::format_first_only` is non-zero then only the
256
  first match found is replaced.
257
 
258
  *Returns:* `out`.
259
 
@@ -280,11 +304,11 @@ template <class traits, class charT, class ST, class SA>
280
 
281
  *Returns:*  `result`.
282
 
283
  ``` cpp
284
  template <class traits, class charT, class ST, class SA>
285
- basic_string<charT>}
286
  regex_replace(const charT* s,
287
  const basic_regex<charT, traits>& e,
288
  const basic_string<charT, ST, SA>& fmt,
289
  regex_constants::match_flag_type flags =
290
  regex_constants::match_default);
 
34
  the effects on parameter `m` are given in Table  [[tab:re:alg:match]].
35
 
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,
 
136
  the effects on parameter `m` are given in Table  [[tab:re:alg:search]].
137
 
138
  **Table: Effects of `regex_search` algorithm** <a id="tab:re:alg:search">[tab:re:alg:search]</a>
139
 
140
  | Element | Value |
141
+ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
142
  | `m.size()` | `1 + e.mark_count()` |
143
  | `m.empty()` | `false` |
144
  | `m.prefix().first` | `first` |
145
  | `m.prefix().second` | `m[0].first` |
146
  | `m.prefix().matched` | `m.prefix().first != m.prefix().second` |
147
  | `m.suffix().first` | `m[0].second` |
148
  | `m.suffix().second` | `last` |
149
  | `m.suffix().matched` | `m.suffix().first != m.suffix().second` |
150
  | `m[0].first` | The start of the sequence of characters that matched the regular expression |
151
  | `m[0].second` | The end of the sequence of characters that matched the regular expression |
152
+ | `m[0].matched` | `true` |
153
+ | `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`. |
154
+ | `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` . |
155
+ | `m[n].matched` | For all integers `0 < n < m.size()`, `true` if sub-expression `n` participated in the match, `false` otherwise. |
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,
 
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
241
+ 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
+ ```
263
+
264
+ for the first form of the function and
265
+ ``` cpp
266
+ out = m.format(out, fmt, fmt + char_traits<charT>::length(fmt), flags)
267
+ ```
268
+
269
+ for the second.
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
 
 
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);