tmp/tmpmzj4pb6b/{from.md → to.md}
RENAMED
|
@@ -3,23 +3,35 @@
|
|
| 3 |
``` cpp
|
| 4 |
template <class BidirectionalIterator, class Allocator, class charT, class traits>
|
| 5 |
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
| 6 |
match_results<BidirectionalIterator, Allocator>& m,
|
| 7 |
const basic_regex<charT, traits>& e,
|
| 8 |
-
regex_constants::match_flag_type flags =
|
| 9 |
-
regex_constants::match_default);
|
| 10 |
```
|
| 11 |
|
| 12 |
*Requires:* The type `BidirectionalIterator` shall satisfy the
|
| 13 |
-
requirements of a Bidirectional Iterator
|
| 14 |
-
([[bidirectional.iterators]]).
|
| 15 |
|
| 16 |
*Effects:* Determines whether there is a match between the regular
|
| 17 |
expression `e`, and all of the character sequence \[`first`, `last`).
|
| 18 |
The parameter `flags` is used to control how the expression is matched
|
| 19 |
-
against the character sequence.
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
*Postconditions:* `m.ready() == true` in all cases. If the function
|
| 23 |
returns `false`, then the effect on parameter `m` is unspecified except
|
| 24 |
that `m.size()` returns `0` and `m.empty()` returns `true`. Otherwise
|
| 25 |
the effects on parameter `m` are given in Table [[tab:re:alg:match]].
|
|
@@ -27,30 +39,29 @@ the effects on parameter `m` are given in Table [[tab:re:alg:match]].
|
|
| 27 |
**Table: Effects of `regex_match` algorithm** <a id="tab:re:alg:match">[tab:re:alg:match]</a>
|
| 28 |
|
| 29 |
| Element | Value |
|
| 30 |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 31 |
| `m.size()` | `1 + e.mark_count()` |
|
| 32 |
-
| `m.empty()` | false
|
| 33 |
-
| `m.prefix().first` | first
|
| 34 |
-
| `m.prefix().second` | first
|
| 35 |
-
| `m.prefix().matched` | false
|
| 36 |
-
| `m.suffix().first` | last
|
| 37 |
-
| `m.suffix().second` | last
|
| 38 |
-
| `m.suffix().matched` | false
|
| 39 |
-
| `m[0].first` | first
|
| 40 |
-
| `m[0].second` | last
|
| 41 |
| `m[0].matched` | `true` |
|
| 42 |
| `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`. |
|
| 43 |
| `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`. |
|
| 44 |
| `m[n].matched` | For all integers `0 < n < m.size()`, `true` if sub-expression `n` participated in the match, `false` otherwise. |
|
| 45 |
|
| 46 |
``` cpp
|
| 47 |
template <class BidirectionalIterator, class charT, class traits>
|
| 48 |
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
| 49 |
const basic_regex<charT, traits>& e,
|
| 50 |
-
regex_constants::match_flag_type flags =
|
| 51 |
-
regex_constants::match_default);
|
| 52 |
```
|
| 53 |
|
| 54 |
*Effects:* Behaves “as if” by constructing an instance of
|
| 55 |
`match_results<BidirectionalIterator> what`, and then returning the
|
| 56 |
result of `regex_match(first, last, what, e, flags)`.
|
|
@@ -58,46 +69,41 @@ result of `regex_match(first, last, what, e, flags)`.
|
|
| 58 |
``` cpp
|
| 59 |
template <class charT, class Allocator, class traits>
|
| 60 |
bool regex_match(const charT* str,
|
| 61 |
match_results<const charT*, Allocator>& m,
|
| 62 |
const basic_regex<charT, traits>& e,
|
| 63 |
-
regex_constants::match_flag_type flags =
|
| 64 |
-
regex_constants::match_default);
|
| 65 |
```
|
| 66 |
|
| 67 |
*Returns:*
|
| 68 |
`regex_match(str, str + char_traits<charT>::length(str), m, e, flags)`.
|
| 69 |
|
| 70 |
``` cpp
|
| 71 |
template <class ST, class SA, class Allocator, class charT, class traits>
|
| 72 |
bool regex_match(const basic_string<charT, ST, SA>& s,
|
| 73 |
-
match_results<
|
| 74 |
-
typename basic_string<charT, ST, SA>::const_iterator,
|
| 75 |
Allocator>& m,
|
| 76 |
const basic_regex<charT, traits>& e,
|
| 77 |
-
regex_constants::match_flag_type flags =
|
| 78 |
-
regex_constants::match_default);
|
| 79 |
```
|
| 80 |
|
| 81 |
*Returns:* `regex_match(s.begin(), s.end(), m, e, flags)`.
|
| 82 |
|
| 83 |
``` cpp
|
| 84 |
template <class charT, class traits>
|
| 85 |
bool regex_match(const charT* str,
|
| 86 |
const basic_regex<charT, traits>& e,
|
| 87 |
-
regex_constants::match_flag_type flags =
|
| 88 |
-
regex_constants::match_default);
|
| 89 |
```
|
| 90 |
|
| 91 |
*Returns:*
|
| 92 |
`regex_match(str, str + char_traits<charT>::length(str), e, flags)`
|
| 93 |
|
| 94 |
``` cpp
|
| 95 |
template <class ST, class SA, class charT, class traits>
|
| 96 |
bool regex_match(const basic_string<charT, ST, SA>& s,
|
| 97 |
const basic_regex<charT, traits>& e,
|
| 98 |
-
regex_constants::match_flag_type flags =
|
| 99 |
-
regex_constants::match_default);
|
| 100 |
```
|
| 101 |
|
| 102 |
*Returns:* `regex_match(s.begin(), s.end(), e, flags)`.
|
| 103 |
|
|
|
|
| 3 |
``` cpp
|
| 4 |
template <class BidirectionalIterator, class Allocator, class charT, class traits>
|
| 5 |
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
| 6 |
match_results<BidirectionalIterator, Allocator>& m,
|
| 7 |
const basic_regex<charT, traits>& e,
|
| 8 |
+
regex_constants::match_flag_type flags = regex_constants::match_default);
|
|
|
|
| 9 |
```
|
| 10 |
|
| 11 |
*Requires:* The type `BidirectionalIterator` shall satisfy the
|
| 12 |
+
requirements of a Bidirectional Iterator ([[bidirectional.iterators]]).
|
|
|
|
| 13 |
|
| 14 |
*Effects:* Determines whether there is a match between the regular
|
| 15 |
expression `e`, and all of the character sequence \[`first`, `last`).
|
| 16 |
The parameter `flags` is used to control how the expression is matched
|
| 17 |
+
against the character sequence. When determining if there is a match,
|
| 18 |
+
only potential matches that match the entire character sequence are
|
| 19 |
+
considered. Returns `true` if such a match exists, `false` otherwise.
|
| 20 |
+
|
| 21 |
+
[*Example 1*:
|
| 22 |
+
|
| 23 |
+
``` cpp
|
| 24 |
+
std::regex re("Get|GetValue");
|
| 25 |
+
std::cmatch m;
|
| 26 |
+
regex_search("GetValue", m, re); // returns true, and m[0] contains "Get"
|
| 27 |
+
regex_match ("GetValue", m, re); // returns true, and m[0] contains "GetValue"
|
| 28 |
+
regex_search("GetValues", m, re); // returns true, and m[0] contains "Get"
|
| 29 |
+
regex_match ("GetValues", m, re); // returns false
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
— *end example*]
|
| 33 |
|
| 34 |
*Postconditions:* `m.ready() == true` in all cases. If the function
|
| 35 |
returns `false`, then the effect on parameter `m` is unspecified except
|
| 36 |
that `m.size()` returns `0` and `m.empty()` returns `true`. Otherwise
|
| 37 |
the effects on parameter `m` are given in Table [[tab:re:alg:match]].
|
|
|
|
| 39 |
**Table: Effects of `regex_match` algorithm** <a id="tab:re:alg:match">[tab:re:alg:match]</a>
|
| 40 |
|
| 41 |
| Element | Value |
|
| 42 |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 43 |
| `m.size()` | `1 + e.mark_count()` |
|
| 44 |
+
| `m.empty()` | `false` |
|
| 45 |
+
| `m.prefix().first` | `first` |
|
| 46 |
+
| `m.prefix().second` | `first` |
|
| 47 |
+
| `m.prefix().matched` | `false` |
|
| 48 |
+
| `m.suffix().first` | `last` |
|
| 49 |
+
| `m.suffix().second` | `last` |
|
| 50 |
+
| `m.suffix().matched` | `false` |
|
| 51 |
+
| `m[0].first` | `first` |
|
| 52 |
+
| `m[0].second` | `last` |
|
| 53 |
| `m[0].matched` | `true` |
|
| 54 |
| `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`. |
|
| 55 |
| `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`. |
|
| 56 |
| `m[n].matched` | For all integers `0 < n < m.size()`, `true` if sub-expression `n` participated in the match, `false` otherwise. |
|
| 57 |
|
| 58 |
``` cpp
|
| 59 |
template <class BidirectionalIterator, class charT, class traits>
|
| 60 |
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
| 61 |
const basic_regex<charT, traits>& e,
|
| 62 |
+
regex_constants::match_flag_type flags = regex_constants::match_default);
|
|
|
|
| 63 |
```
|
| 64 |
|
| 65 |
*Effects:* Behaves “as if” by constructing an instance of
|
| 66 |
`match_results<BidirectionalIterator> what`, and then returning the
|
| 67 |
result of `regex_match(first, last, what, e, flags)`.
|
|
|
|
| 69 |
``` cpp
|
| 70 |
template <class charT, class Allocator, class traits>
|
| 71 |
bool regex_match(const charT* str,
|
| 72 |
match_results<const charT*, Allocator>& m,
|
| 73 |
const basic_regex<charT, traits>& e,
|
| 74 |
+
regex_constants::match_flag_type flags = regex_constants::match_default);
|
|
|
|
| 75 |
```
|
| 76 |
|
| 77 |
*Returns:*
|
| 78 |
`regex_match(str, str + char_traits<charT>::length(str), m, e, flags)`.
|
| 79 |
|
| 80 |
``` cpp
|
| 81 |
template <class ST, class SA, class Allocator, class charT, class traits>
|
| 82 |
bool regex_match(const basic_string<charT, ST, SA>& s,
|
| 83 |
+
match_results<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 = regex_constants::match_default);
|
|
|
|
| 87 |
```
|
| 88 |
|
| 89 |
*Returns:* `regex_match(s.begin(), s.end(), m, e, flags)`.
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
template <class charT, class traits>
|
| 93 |
bool regex_match(const charT* str,
|
| 94 |
const basic_regex<charT, traits>& e,
|
| 95 |
+
regex_constants::match_flag_type flags = regex_constants::match_default);
|
|
|
|
| 96 |
```
|
| 97 |
|
| 98 |
*Returns:*
|
| 99 |
`regex_match(str, str + char_traits<charT>::length(str), e, flags)`
|
| 100 |
|
| 101 |
``` cpp
|
| 102 |
template <class ST, class SA, class charT, class traits>
|
| 103 |
bool regex_match(const basic_string<charT, ST, SA>& s,
|
| 104 |
const basic_regex<charT, traits>& e,
|
| 105 |
+
regex_constants::match_flag_type flags = regex_constants::match_default);
|
|
|
|
| 106 |
```
|
| 107 |
|
| 108 |
*Returns:* `regex_match(s.begin(), s.end(), e, flags)`.
|
| 109 |
|