3515 lines
152 KiB
Markdown
3515 lines
152 KiB
Markdown
[re]
|
||
|
||
# 28 Text processing library [[text]](./#text)
|
||
|
||
## 28.6 Regular expressions library [re]
|
||
|
||
### [28.6.1](#general) General [[re.general]](re.general)
|
||
|
||
[1](#general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L8998)
|
||
|
||
Subclause [re] describes components that C++ programs may use to
|
||
perform operations involving regular expression matching and
|
||
searching[.](#general-1.sentence-1)
|
||
|
||
[2](#general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9003)
|
||
|
||
The following subclauses describe a basic regular expression class template and its
|
||
traits that can handle char-like ([[strings.general]](strings.general "27.1 General")) template arguments,
|
||
two specializations of this class template that handle sequences of char and wchar_t,
|
||
a class template that holds the
|
||
result of a regular expression match, a series of algorithms that allow a character
|
||
sequence to be operated upon by a regular expression,
|
||
and two iterator types for
|
||
enumerating regular expression matches, as summarized in Table [117](#tab:re.summary "Table 117: Regular expressions library summary")[.](#general-2.sentence-1)
|
||
|
||
Table [117](#tab:re.summary) — Regular expressions library summary [[tab:re.summary]](./tab:re.summary)
|
||
|
||
| [ð](#tab:re.summary-row-1) | **Subclause** | **Header** |
|
||
| --- | --- | --- |
|
||
| [ð](#tab:re.summary-row-2)<br>[[re.req]](#req "28.6.2 Requirements") | Requirements | |
|
||
| [ð](#tab:re.summary-row-3)<br>[[re.const]](#const "28.6.4 Namespace std::regex_constants") | Constants | <regex> |
|
||
| [ð](#tab:re.summary-row-4)<br>[[re.badexp]](#badexp "28.6.5 Class regex_error") | Exception type | |
|
||
| [ð](#tab:re.summary-row-5)<br>[[re.traits]](#traits "28.6.6 Class template regex_traits") | Traits | |
|
||
| [ð](#tab:re.summary-row-6)<br>[[re.regex]](#regex "28.6.7 Class template basic_regex") | Regular expression template | |
|
||
| [ð](#tab:re.summary-row-7)<br>[[re.submatch]](#submatch "28.6.8 Class template sub_match") | Submatches | |
|
||
| [ð](#tab:re.summary-row-8)<br>[[re.results]](#results "28.6.9 Class template match_results") | Match results | |
|
||
| [ð](#tab:re.summary-row-9)<br>[[re.alg]](#alg "28.6.10 Regular expression algorithms") | Algorithms | |
|
||
| [ð](#tab:re.summary-row-10)<br>[[re.iter]](#iter "28.6.11 Regular expression iterators") | Iterators | |
|
||
| [ð](#tab:re.summary-row-11)<br>[[re.grammar]](#grammar "28.6.12 Modified ECMAScript regular expression grammar") | Grammar | |
|
||
|
||
[3](#general-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9026)
|
||
|
||
The ECMAScript Language Specification described in Standard Ecma-262
|
||
is called [*ECMA-262*](#def:ECMA-262 "28.6.1 General [re.general]") in this Clause[.](#general-3.sentence-1)
|
||
|
||
### [28.6.2](#req) Requirements [[re.req]](re.req)
|
||
|
||
[1](#req-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9032)
|
||
|
||
This subclause defines requirements on classes representing regular
|
||
expression traits[.](#req-1.sentence-1)
|
||
|
||
[*Note [1](#req-note-1)*:
|
||
|
||
The class templateregex_traits, defined in [[re.traits]](#traits "28.6.6 Class template regex_traits"),
|
||
meets these requirements[.](#req-1.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
[2](#req-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9041)
|
||
|
||
The class template basic_regex, defined in[[re.regex]](#regex "28.6.7 Class template basic_regex"), needs a set of related types and
|
||
functions to complete the definition of its semantics[.](#req-2.sentence-1)
|
||
|
||
These types
|
||
and functions are provided as a set of member [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]")*s* and functions
|
||
in the template parameter traits used by the basic_regex class
|
||
template[.](#req-2.sentence-2)
|
||
|
||
This subclause defines the semantics of these
|
||
members[.](#req-2.sentence-3)
|
||
|
||
[3](#req-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9050)
|
||
|
||
To specialize class template basic_regex for a character
|
||
container CharT and its related regular
|
||
expression traits class Traits, use basic_regex<CharT, Traits>[.](#req-3.sentence-1)
|
||
|
||
[4](#req-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9055)
|
||
|
||
In the following requirements,
|
||
|
||
- [(4.1)](#req-4.1)
|
||
|
||
X denotes a traits class defining types and functions
|
||
for the character container type charT;
|
||
|
||
- [(4.2)](#req-4.2)
|
||
|
||
u is an object of type X;
|
||
|
||
- [(4.3)](#req-4.3)
|
||
|
||
v is an object of type const X;
|
||
|
||
- [(4.4)](#req-4.4)
|
||
|
||
p is a value of type const charT*;
|
||
|
||
- [(4.5)](#req-4.5)
|
||
|
||
I1 and I2 are input iterators ([[input.iterators]](input.iterators "24.3.5.3 Input iterators"));
|
||
|
||
- [(4.6)](#req-4.6)
|
||
|
||
F1 and F2 are forward iterators ([[forward.iterators]](forward.iterators "24.3.5.5 Forward iterators"));
|
||
|
||
- [(4.7)](#req-4.7)
|
||
|
||
c is a value of type const charT;
|
||
|
||
- [(4.8)](#req-4.8)
|
||
|
||
s is an object of type X::string_type;
|
||
|
||
- [(4.9)](#req-4.9)
|
||
|
||
cs is an object of type const X::string_type;
|
||
|
||
- [(4.10)](#req-4.10)
|
||
|
||
b is a value of type bool;
|
||
|
||
- [(4.11)](#req-4.11)
|
||
|
||
I is a value of type int;
|
||
|
||
- [(4.12)](#req-4.12)
|
||
|
||
cl is an object of type X::char_class_type; and
|
||
|
||
- [(4.13)](#req-4.13)
|
||
|
||
loc is an object of type X::locale_type[.](#req-4.sentence-1)
|
||
|
||
[5](#req-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9091)
|
||
|
||
A traits class X meets the regular expression traits requirements
|
||
if the following types and expressions are well-formed and have the specified
|
||
semantics[.](#req-5.sentence-1)
|
||
|
||
[ð](#req-itemdecl:1)
|
||
|
||
`typename X::char_type
|
||
`
|
||
|
||
[6](#req-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9101)
|
||
|
||
*Result*: charT,
|
||
the character container type used in the implementation of class
|
||
template basic_regex[.](#req-6.sentence-1)
|
||
|
||
[ð](#req-itemdecl:2)
|
||
|
||
`typename X::string_type
|
||
`
|
||
|
||
[7](#req-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9113)
|
||
|
||
*Result*: basic_string<charT>
|
||
|
||
[ð](#req-itemdecl:3)
|
||
|
||
`typename X::locale_type
|
||
`
|
||
|
||
[8](#req-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9123)
|
||
|
||
*Result*: A copy constructible type
|
||
that represents the locale used by the traits class[.](#req-8.sentence-1)
|
||
|
||
[ð](#req-itemdecl:4)
|
||
|
||
`typename X::char_class_type
|
||
`
|
||
|
||
[9](#req-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9134)
|
||
|
||
*Result*: A bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types"))
|
||
representing a particular character classification[.](#req-9.sentence-1)
|
||
|
||
[ð](#req-itemdecl:5)
|
||
|
||
`X::length(p)
|
||
`
|
||
|
||
[10](#req-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9145)
|
||
|
||
*Result*: size_t
|
||
|
||
[11](#req-11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9149)
|
||
|
||
*Returns*: The smallest i such that p[i] == 0[.](#req-11.sentence-1)
|
||
|
||
[12](#req-12)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9153)
|
||
|
||
*Complexity*: Linear in i[.](#req-12.sentence-1)
|
||
|
||
[ð](#req-itemdecl:6)
|
||
|
||
`v.translate(c)
|
||
`
|
||
|
||
[13](#req-13)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9163)
|
||
|
||
*Result*: X::char_type
|
||
|
||
[14](#req-14)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9167)
|
||
|
||
*Returns*: A character such that for any character d that is to be considered equivalent to c then v.translate(c) == v.translate(d)[.](#req-14.sentence-1)
|
||
|
||
[ð](#req-itemdecl:7)
|
||
|
||
`v.translate_nocase(c)
|
||
`
|
||
|
||
[15](#req-15)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9179)
|
||
|
||
*Result*: X::char_type
|
||
|
||
[16](#req-16)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9183)
|
||
|
||
*Returns*: For all characters C that are to be considered equivalent to c when comparisons are to be performed without regard to case,
|
||
then v.translate_nocase(c) == v.translate_nocase(C)[.](#req-16.sentence-1)
|
||
|
||
[ð](#req-itemdecl:8)
|
||
|
||
`v.transform(F1, F2)
|
||
`
|
||
|
||
[17](#req-17)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9195)
|
||
|
||
*Result*: X::string_type
|
||
|
||
[18](#req-18)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9199)
|
||
|
||
*Returns*: A sort key for the character sequence designated by
|
||
the iterator range [F1, F2) such that
|
||
if the character sequence [G1, G2) sorts before
|
||
the character sequence [H1, H2)
|
||
then v.transform(G1, G2) < v.transform(H1, H2)[.](#req-18.sentence-1)
|
||
|
||
[ð](#req-itemdecl:9)
|
||
|
||
`v.transform_primary(F1, F2)
|
||
`
|
||
|
||
[19](#req-19)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9213)
|
||
|
||
*Result*: X::string_type
|
||
|
||
[20](#req-20)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9219)
|
||
|
||
*Returns*: A sort key for the character sequence designated by
|
||
the iterator range [F1, F2) such that
|
||
if the character sequence [G1, G2) sorts before
|
||
the character sequence [H1, H2)
|
||
when character case is not considered
|
||
then v.transform_primary(G1, G2) < v.transform_primary(H1, H2)[.](#req-20.sentence-1)
|
||
|
||
[ð](#req-itemdecl:10)
|
||
|
||
`v.lookup_collatename(F1, F2)
|
||
`
|
||
|
||
[21](#req-21)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9234)
|
||
|
||
*Result*: X::string_type
|
||
|
||
[22](#req-22)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9238)
|
||
|
||
*Returns*: A sequence of characters that represents the collating element
|
||
consisting of the character sequence designated by
|
||
the iterator range [F1, F2)[.](#req-22.sentence-1)
|
||
|
||
Returns an empty string
|
||
if the character sequence is not a valid collating element[.](#req-22.sentence-2)
|
||
|
||
[ð](#req-itemdecl:11)
|
||
|
||
`v.lookup_classname(F1, F2, b)
|
||
`
|
||
|
||
[23](#req-23)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9252)
|
||
|
||
*Result*: X::char_class_type
|
||
|
||
[24](#req-24)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9256)
|
||
|
||
*Returns*: Converts the character sequence designated by the iterator range
|
||
[F1, F2) into a value of a bitmask type that can
|
||
subsequently be passed to isctype[.](#req-24.sentence-1)
|
||
|
||
Values returned from lookup_classname can be bitwise or'ed together;
|
||
the resulting value represents membership
|
||
in either of the corresponding character classes[.](#req-24.sentence-2)
|
||
|
||
If b is true, the returned bitmask is suitable for
|
||
matching characters without regard to their case[.](#req-24.sentence-3)
|
||
|
||
Returns 0 if the character sequence is not the name of
|
||
a character class recognized by X[.](#req-24.sentence-4)
|
||
|
||
The value returned shall be independent of
|
||
the case of the characters in the sequence[.](#req-24.sentence-5)
|
||
|
||
[ð](#req-itemdecl:12)
|
||
|
||
`v.isctype(c, cl)
|
||
`
|
||
|
||
[25](#req-25)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9278)
|
||
|
||
*Result*: bool
|
||
|
||
[26](#req-26)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9282)
|
||
|
||
*Returns*: Returns true if character c is a member of
|
||
one of the character classes designated by cl,false otherwise[.](#req-26.sentence-1)
|
||
|
||
[ð](#req-itemdecl:13)
|
||
|
||
`v.value(c, I)
|
||
`
|
||
|
||
[27](#req-27)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9294)
|
||
|
||
*Result*: int
|
||
|
||
[28](#req-28)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9298)
|
||
|
||
*Returns*: Returns the value represented by the digit *c* in base*I* if the character *c* is a valid digit in base *I*;
|
||
otherwise returns -1[.](#req-28.sentence-1)
|
||
|
||
[*Note [2](#req-note-2)*:
|
||
|
||
The value of *I* will only be 8, 10, or 16[.](#req-28.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
[ð](#req-itemdecl:14)
|
||
|
||
`u.imbue(loc)
|
||
`
|
||
|
||
[29](#req-29)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9313)
|
||
|
||
*Result*: X::locale_type
|
||
|
||
[30](#req-30)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9318)
|
||
|
||
*Effects*: Imbues u with the locale loc and
|
||
returns the previous locale used by u if any[.](#req-30.sentence-1)
|
||
|
||
[ð](#req-itemdecl:15)
|
||
|
||
`v.getloc()
|
||
`
|
||
|
||
[31](#req-31)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9329)
|
||
|
||
*Result*: X::locale_type
|
||
|
||
[32](#req-32)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9333)
|
||
|
||
*Returns*: Returns the current locale used by v, if any[.](#req-32.sentence-1)
|
||
|
||
[33](#req-33)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9338)
|
||
|
||
[*Note [3](#req-note-3)*:
|
||
|
||
Class template regex_traits meets the requirements for a
|
||
regular expression traits class when it is specialized forchar or wchar_t[.](#req-33.sentence-1)
|
||
|
||
This class template is described in
|
||
the header [<regex>](#header:%3cregex%3e "28.6.3 Header <regex> synopsis [re.syn]"), and is described in [[re.traits]](#traits "28.6.6 Class template regex_traits")[.](#req-33.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
### [28.6.3](#syn) Header <regex> synopsis [[re.syn]](re.syn)
|
||
|
||
[ð](#header:%3cregex%3e)
|
||
|
||
#include <compare> // see [[compare.syn]](compare.syn "17.12.1 Header <compare> synopsis")#include <initializer_list> // see [[initializer.list.syn]](initializer.list.syn "17.11.2 Header <initializer_list> synopsis")namespace std {// [[re.const]](#const "28.6.4 Namespace std::regex_constants"), regex constantsnamespace regex_constants {using syntax_option_type = *T1*; using match_flag_type = *T2*; using error_type = *T3*; }// [[re.badexp]](#badexp "28.6.5 Class regex_error"), class regex_errorclass regex_error; // [[re.traits]](#traits "28.6.6 Class template regex_traits"), class template regex_traitstemplate<class charT> struct regex_traits; // [[re.regex]](#regex "28.6.7 Class template basic_regex"), class template basic_regextemplate<class charT, class traits = regex_traits<charT>> class basic_regex; using regex = basic_regex<char>; using wregex = basic_regex<wchar_t>; // [[re.regex.swap]](#regex.swap "28.6.7.6 Swap"), basic_regex swaptemplate<class charT, class traits>void swap(basic_regex<charT, traits>& e1, basic_regex<charT, traits>& e2); // [[re.submatch]](#submatch "28.6.8 Class template sub_match"), class template sub_matchtemplate<class BidirectionalIterator>class sub_match; using csub_match = sub_match<const char*>; using wcsub_match = sub_match<const wchar_t*>; using ssub_match = sub_match<string::const_iterator>; using wssub_match = sub_match<wstring::const_iterator>; // [[re.submatch.op]](#submatch.op "28.6.8.3 Non-member operators"), sub_match non-member operatorstemplate<class BiIter>bool operator==(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs); template<class BiIter>auto operator<=>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs); template<class BiIter, class ST, class SA>bool operator==(const sub_match<BiIter>& lhs, const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs); template<class BiIter, class ST, class SA>auto operator<=>(const sub_match<BiIter>& lhs, const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs); template<class BiIter>bool operator==(const sub_match<BiIter>& lhs, const typename iterator_traits<BiIter>::value_type* rhs); template<class BiIter>auto operator<=>(const sub_match<BiIter>& lhs, const typename iterator_traits<BiIter>::value_type* rhs); template<class BiIter>bool operator==(const sub_match<BiIter>& lhs, const typename iterator_traits<BiIter>::value_type& rhs); template<class BiIter>auto operator<=>(const sub_match<BiIter>& lhs, const typename iterator_traits<BiIter>::value_type& rhs); template<class charT, class ST, class BiIter> basic_ostream<charT, ST>&operator<<(basic_ostream<charT, ST>& os, const sub_match<BiIter>& m); // [[re.results]](#results "28.6.9 Class template match_results"), class template match_resultstemplate<class BidirectionalIterator, class Allocator = allocator<sub_match<BidirectionalIterator>>>class match_results; using cmatch = match_results<const char*>; using wcmatch = match_results<const wchar_t*>; using smatch = match_results<string::const_iterator>; using wsmatch = match_results<wstring::const_iterator>; // match_results comparisonstemplate<class BidirectionalIterator, class Allocator>bool operator==(const match_results<BidirectionalIterator, Allocator>& m1, const match_results<BidirectionalIterator, Allocator>& m2); // [[re.results.swap]](#results.swap "28.6.9.8 Swap"), match_results swaptemplate<class BidirectionalIterator, class Allocator>void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||
match_results<BidirectionalIterator, Allocator>& m2); // [[re.alg.match]](#alg.match "28.6.10.2 regex_match"), function template regex_matchtemplate<class BidirectionalIterator, class Allocator, class charT, class traits>bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
||
match_results<BidirectionalIterator, Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class BidirectionalIterator, class charT, class traits>bool regex_match(BidirectionalIterator first, BidirectionalIterator last, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class charT, class Allocator, class traits>bool regex_match(const charT* str, match_results<const charT*, Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class Allocator, class charT, class traits>bool regex_match(const basic_string<charT, ST, SA>& s,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class Allocator, class charT, class traits>bool regex_match(const basic_string<charT, ST, SA>&&,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>&, const basic_regex<charT, traits>&,
|
||
regex_constants::match_flag_type = regex_constants::match_default) = delete; template<class charT, class traits>bool regex_match(const charT* str, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class charT, class traits>bool regex_match(const basic_string<charT, ST, SA>& s, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); // [[re.alg.search]](#alg.search "28.6.10.3 regex_search"), function template regex_searchtemplate<class BidirectionalIterator, class Allocator, class charT, class traits>bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||
match_results<BidirectionalIterator, Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class BidirectionalIterator, class charT, class traits>bool regex_search(BidirectionalIterator first, BidirectionalIterator last, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class charT, class Allocator, class traits>bool regex_search(const charT* str,
|
||
match_results<const charT*, Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class charT, class traits>bool regex_search(const charT* str, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class charT, class traits>bool regex_search(const basic_string<charT, ST, SA>& s, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class Allocator, class charT, class traits>bool regex_search(const basic_string<charT, ST, SA>& s,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class Allocator, class charT, class traits>bool regex_search(const basic_string<charT, ST, SA>&&,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>&, const basic_regex<charT, traits>&,
|
||
regex_constants::match_flag_type = regex_constants::match_default) = delete; // [[re.alg.replace]](#alg.replace "28.6.10.4 regex_replace"), function template regex_replacetemplate<class OutputIterator, class BidirectionalIterator, class traits, class charT, class ST, class SA> OutputIterator
|
||
regex_replace(OutputIterator out,
|
||
BidirectionalIterator first, BidirectionalIterator last, const basic_regex<charT, traits>& e, const basic_string<charT, ST, SA>& fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class OutputIterator, class BidirectionalIterator, class traits, class charT> OutputIterator
|
||
regex_replace(OutputIterator out,
|
||
BidirectionalIterator first, BidirectionalIterator last, const basic_regex<charT, traits>& e, const charT* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class traits, class charT, class ST, class SA, class FST, class FSA> basic_string<charT, ST, SA> regex_replace(const basic_string<charT, ST, SA>& s, const basic_regex<charT, traits>& e, const basic_string<charT, FST, FSA>& fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class traits, class charT, class ST, class SA> basic_string<charT, ST, SA> regex_replace(const basic_string<charT, ST, SA>& s, const basic_regex<charT, traits>& e, const charT* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class traits, class charT, class ST, class SA> basic_string<charT> regex_replace(const charT* s, const basic_regex<charT, traits>& e, const basic_string<charT, ST, SA>& fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class traits, class charT> basic_string<charT> regex_replace(const charT* s, const basic_regex<charT, traits>& e, const charT* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); // [[re.regiter]](#regiter "28.6.11.1 Class template regex_iterator"), class template regex_iteratortemplate<class BidirectionalIterator, class charT = typename iterator_traits<BidirectionalIterator>::value_type, class traits = regex_traits<charT>>class regex_iterator; using cregex_iterator = regex_iterator<const char*>; using wcregex_iterator = regex_iterator<const wchar_t*>; using sregex_iterator = regex_iterator<string::const_iterator>; using wsregex_iterator = regex_iterator<wstring::const_iterator>; // [[re.tokiter]](#tokiter "28.6.11.2 Class template regex_token_iterator"), class template regex_token_iteratortemplate<class BidirectionalIterator, class charT = typename iterator_traits<BidirectionalIterator>::value_type, class traits = regex_traits<charT>>class regex_token_iterator; using cregex_token_iterator = regex_token_iterator<const char*>; using wcregex_token_iterator = regex_token_iterator<const wchar_t*>; using sregex_token_iterator = regex_token_iterator<string::const_iterator>; using wsregex_token_iterator = regex_token_iterator<wstring::const_iterator>; namespace pmr {template<class BidirectionalIterator>using match_results = std::match_results<BidirectionalIterator,
|
||
polymorphic_allocator<sub_match<BidirectionalIterator>>>; using cmatch = match_results<const char*>; using wcmatch = match_results<const wchar_t*>; using smatch = match_results<string::const_iterator>; using wsmatch = match_results<wstring::const_iterator>; }}
|
||
|
||
### [28.6.4](#const) Namespace std::regex_constants [[re.const]](re.const)
|
||
|
||
#### [28.6.4.1](#const.general) General [[re.const.general]](re.const.general)
|
||
|
||
[1](#const.general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9595)
|
||
|
||
The namespace std::regex_constants holds
|
||
symbolic constants used by the regular expression library[.](#const.general-1.sentence-1)
|
||
|
||
This
|
||
namespace provides three types, syntax_option_type,match_flag_type, and error_type, along with several
|
||
constants of these types[.](#const.general-1.sentence-2)
|
||
|
||
#### [28.6.4.2](#synopt) Bitmask type syntax_option_type [[re.synopt]](re.synopt)
|
||
|
||
[ð](#lib:syntax_option_type)
|
||
|
||
namespace std::regex_constants {using syntax_option_type = *T1*; inline constexpr syntax_option_type icase = *unspecified*; inline constexpr syntax_option_type nosubs = *unspecified*; inline constexpr syntax_option_type optimize = *unspecified*; inline constexpr syntax_option_type collate = *unspecified*; inline constexpr syntax_option_type ECMAScript = *unspecified*; inline constexpr syntax_option_type basic = *unspecified*; inline constexpr syntax_option_type extended = *unspecified*; inline constexpr syntax_option_type awk = *unspecified*; inline constexpr syntax_option_type grep = *unspecified*; inline constexpr syntax_option_type egrep = *unspecified*; inline constexpr syntax_option_type multiline = *unspecified*;}
|
||
|
||
[1](#synopt-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9623)
|
||
|
||
The type syntax_option_type is an implementation-defined bitmask
|
||
type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types"))[.](#synopt-1.sentence-1)
|
||
|
||
Setting its elements has the effects listed in
|
||
Table [118](#tab:re.synopt "Table 118: syntax_option_type effects")[.](#synopt-1.sentence-2)
|
||
|
||
A valid value of typesyntax_option_type shall have at most one of the grammar elementsECMAScript, basic, extended, awk, grep, egrep, set[.](#synopt-1.sentence-3)
|
||
|
||
If no grammar element is set, the default grammar is ECMAScript[.](#synopt-1.sentence-4)
|
||
|
||
Table [118](#tab:re.synopt) — syntax_option_type effects [[tab:re.synopt]](./tab:re.synopt)
|
||
|
||
| [ð](#tab:re.synopt-row-1)<br>**Element** | **Effect(s) if set** |
|
||
| --- | --- |
|
||
| [ð](#tab:re.synopt-row-2)<br>icase | Specifies that matching of regular expressions against a character container sequence shall be performed without regard to case[.](#tab:re.synopt-row-2-column-2-sentence-1) |
|
||
| [ð](#tab:re.synopt-row-3)<br>nosubs | Specifies that no sub-expressions shall be considered to be marked, so that when a regular expression is matched against a character container sequence, no sub-expression matches shall be stored in the supplied match_results object[.](#tab:re.synopt-row-3-column-2-sentence-1) |
|
||
| [ð](#tab:re.synopt-row-4)<br>optimize | Specifies that the regular expression engine should pay more attention to the speed with which regular expressions are matched, and less to the speed with which regular expression objects are constructed[.](#tab:re.synopt-row-4-column-2-sentence-1)<br>Otherwise it has no detectable effect on the program output[.](#tab:re.synopt-row-4-column-2-sentence-2) |
|
||
| [ð](#tab:re.synopt-row-5)<br>collate | Specifies that character ranges of the form "[a-b]" shall be locale sensitive[.](#tab:re.synopt-row-5-column-2-sentence-1) |
|
||
| [ð](#tab:re.synopt-row-6)<br>ECMAScript | Specifies that the grammar recognized by the regular expression engine shall be that used by ECMAScript in ECMA-262, as modified in [[re.grammar]](#grammar "28.6.12 Modified ECMAScript regular expression grammar")[.](#tab:re.synopt-row-6-column-2-sentence-1)<br> See also: ECMA-262 15.10 |
|
||
| [ð](#tab:re.synopt-row-7)<br>basic | Specifies that the grammar recognized by the regular expression engine shall be that used by basic regular expressions in POSIX[.](#tab:re.synopt-row-7-column-2-sentence-1) See also: POSIX, Base Definitions and Headers, Section 9.3 |
|
||
| [ð](#tab:re.synopt-row-8)<br>extended | Specifies that the grammar recognized by the regular expression engine shall be that used by extended regular expressions in POSIX[.](#tab:re.synopt-row-8-column-2-sentence-1) See also: POSIX, Base Definitions and Headers, Section 9.4 |
|
||
| [ð](#tab:re.synopt-row-9)<br>awk | Specifies that the grammar recognized by the regular expression engine shall be that used by the utility awk in POSIX[.](#tab:re.synopt-row-9-column-2-sentence-1) |
|
||
| [ð](#tab:re.synopt-row-10)<br>grep | Specifies that the grammar recognized by the regular expression engine shall be that used by the utility grep in POSIX[.](#tab:re.synopt-row-10-column-2-sentence-1) |
|
||
| [ð](#tab:re.synopt-row-11)<br>egrep | Specifies that the grammar recognized by the regular expression engine shall be that used by the utility grep when given the -E option in POSIX[.](#tab:re.synopt-row-11-column-2-sentence-1) |
|
||
| [ð](#tab:re.synopt-row-12)<br>multiline | Specifies that ^ shall match the beginning of a line and $ shall match the end of a line, if the ECMAScript engine is selected[.](#tab:re.synopt-row-12-column-2-sentence-1) |
|
||
|
||
#### [28.6.4.3](#matchflag) Bitmask type match_flag_type [[re.matchflag]](re.matchflag)
|
||
|
||
[ð](#lib:match_flag_type)
|
||
|
||
namespace std::regex_constants {using match_flag_type = *T2*; inline constexpr match_flag_type match_default = {}; inline constexpr match_flag_type match_not_bol = *unspecified*; inline constexpr match_flag_type match_not_eol = *unspecified*; inline constexpr match_flag_type match_not_bow = *unspecified*; inline constexpr match_flag_type match_not_eow = *unspecified*; inline constexpr match_flag_type match_any = *unspecified*; inline constexpr match_flag_type match_not_null = *unspecified*; inline constexpr match_flag_type match_continuous = *unspecified*; inline constexpr match_flag_type match_prev_avail = *unspecified*; inline constexpr match_flag_type format_default = {}; inline constexpr match_flag_type format_sed = *unspecified*; inline constexpr match_flag_type format_no_copy = *unspecified*; inline constexpr match_flag_type format_first_only = *unspecified*;}
|
||
|
||
[1](#matchflag-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9764)
|
||
|
||
The type match_flag_type is animplementation-defined bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types"))[.](#matchflag-1.sentence-1)
|
||
|
||
The constants of that type, except for match_default andformat_default, are bitmask elements[.](#matchflag-1.sentence-2)
|
||
|
||
The match_default andformat_default constants are empty bitmasks[.](#matchflag-1.sentence-3)
|
||
|
||
Matching a regular expression against a sequence of characters
|
||
[first, last) proceeds according to the rules of the grammar specified for the regular
|
||
expression object, modified according to the effects listed in Table [119](#tab:re.matchflag "Table 119: regex_constants::match_flag_type effects") for
|
||
any bitmask elements set[.](#matchflag-1.sentence-4)
|
||
|
||
Table [119](#tab:re.matchflag) — regex_constants::match_flag_type effects [[tab:re.matchflag]](./tab:re.matchflag)
|
||
|
||
| [ð](#tab:re.matchflag-row-1)<br>**Element** | **Effect(s) if set** |
|
||
| --- | --- |
|
||
| [ð](#tab:re.matchflag-row-2)<br>match_not_bol | The first character in the sequence [first, last) shall be treated as though it is not at the beginning of a line, so the character `^` in the regular expression shall not match [first, first)[.](#tab:re.matchflag-row-2-column-2-sentence-1) |
|
||
| [ð](#tab:re.matchflag-row-3)<br>match_not_eol | The last character in the sequence [first, last) shall be treated as though it is not at the end of a line, so the character `"$"` in the regular expression shall not match [last, last)[.](#tab:re.matchflag-row-3-column-2-sentence-1) |
|
||
| [ð](#tab:re.matchflag-row-4)<br>match_not_bow | The expression `"\\b"` shall not match the sub-sequence [first, first)[.](#tab:re.matchflag-row-4-column-2-sentence-1) |
|
||
| [ð](#tab:re.matchflag-row-5)<br>match_not_eow | The expression `"\\b"` shall not match the sub-sequence [last, last)[.](#tab:re.matchflag-row-5-column-2-sentence-1) |
|
||
| [ð](#tab:re.matchflag-row-6)<br>match_any | If more than one match is possible then any match is an acceptable result[.](#tab:re.matchflag-row-6-column-2-sentence-1) |
|
||
| [ð](#tab:re.matchflag-row-7)<br>match_not_null | The expression shall not match an empty sequence[.](#tab:re.matchflag-row-7-column-2-sentence-1) |
|
||
| [ð](#tab:re.matchflag-row-8)<br>match_continuous | The expression shall only match a sub-sequence that begins at first[.](#tab:re.matchflag-row-8-column-2-sentence-1) |
|
||
| [ð](#tab:re.matchflag-row-9)<br>match_prev_avail | `--first` is a valid iterator position[.](#tab:re.matchflag-row-9-column-2-sentence-1)<br>When this flag is set the flags match_not_bol and match_not_bow shall be ignored by the regular expression algorithms ([[re.alg]](#alg "28.6.10 Regular expression algorithms")) and iterators ([[re.iter]](#iter "28.6.11 Regular expression iterators"))[.](#tab:re.matchflag-row-9-column-2-sentence-2) |
|
||
| [ð](#tab:re.matchflag-row-10)<br>format_default | When a regular expression match is to be replaced by a new string, the new string shall be constructed using the rules used by the ECMAScript replace function in ECMA-262, part 15.5.4.11 String.prototype.replace[.](#tab:re.matchflag-row-10-column-2-sentence-1)<br>In addition, during search and replace operations all non-overlapping occurrences of the regular expression shall be located and replaced, and sections of the input that did not match the expression shall be copied unchanged to the output string[.](#tab:re.matchflag-row-10-column-2-sentence-2) |
|
||
| [ð](#tab:re.matchflag-row-11)<br>format_sed | When a regular expression match is to be replaced by a new string, the new string shall be constructed using the rules used by the sed utility in POSIX[.](#tab:re.matchflag-row-11-column-2-sentence-1) |
|
||
| [ð](#tab:re.matchflag-row-12)<br>format_no_copy | During a search and replace operation, sections of the character container sequence being searched that do not match the regular expression shall not be copied to the output string[.](#tab:re.matchflag-row-12-column-2-sentence-1) |
|
||
| [ð](#tab:re.matchflag-row-13)<br>format_first_only | When specified during a search and replace operation, only the first occurrence of the regular expression shall be replaced[.](#tab:re.matchflag-row-13-column-2-sentence-1) |
|
||
|
||
#### [28.6.4.4](#err) Implementation-defined error_type [[re.err]](re.err)
|
||
|
||
[ð](#lib:error_type)
|
||
|
||
namespace std::regex_constants {using error_type = *T3*; inline constexpr error_type error_collate = *unspecified*; inline constexpr error_type error_ctype = *unspecified*; inline constexpr error_type error_escape = *unspecified*; inline constexpr error_type error_backref = *unspecified*; inline constexpr error_type error_brack = *unspecified*; inline constexpr error_type error_paren = *unspecified*; inline constexpr error_type error_brace = *unspecified*; inline constexpr error_type error_badbrace = *unspecified*; inline constexpr error_type error_range = *unspecified*; inline constexpr error_type error_space = *unspecified*; inline constexpr error_type error_badrepeat = *unspecified*; inline constexpr error_type error_complexity = *unspecified*; inline constexpr error_type error_stack = *unspecified*;}
|
||
|
||
[1](#err-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9885)
|
||
|
||
The type error_type is an implementation-defined enumerated type ([[enumerated.types]](enumerated.types "16.3.3.3.2 Enumerated types"))[.](#err-1.sentence-1)
|
||
|
||
Values of type error_type represent the error
|
||
conditions described in Table [120](#tab:re.err "Table 120: error_type values in the C locale"):
|
||
|
||
Table [120](#tab:re.err) — error_type values in the C locale [[tab:re.err]](./tab:re.err)
|
||
|
||
| [ð](#tab:re.err-row-1)<br>**Value** | **Error condition** |
|
||
| --- | --- |
|
||
| [ð](#tab:re.err-row-2)<br>error_collate | The expression contains an invalid collating element name[.](#tab:re.err-row-2-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-3)<br>error_ctype | The expression contains an invalid character class name[.](#tab:re.err-row-3-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-4)<br>error_escape | The expression contains an invalid escaped character, or a trailing escape[.](#tab:re.err-row-4-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-5)<br>error_backref | The expression contains an invalid back reference[.](#tab:re.err-row-5-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-6)<br>error_brack | The expression contains mismatched `[` and `]`[.](#tab:re.err-row-6-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-7)<br>error_paren | The expression contains mismatched `(` and `)`[.](#tab:re.err-row-7-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-8)<br>error_brace | The expression contains mismatched `{` and `}`[.](#tab:re.err-row-8-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-9)<br>error_badbrace | The expression contains an invalid range in a `{}` expression[.](#tab:re.err-row-9-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-10)<br>error_range | The expression contains an invalid character range, such as `[b-a]` in most encodings[.](#tab:re.err-row-10-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-11)<br>error_space | There is insufficient memory to convert the expression into a finite state machine[.](#tab:re.err-row-11-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-12)<br>error_badrepeat | One of `*?+{` is not preceded by a valid regular expression[.](#tab:re.err-row-12-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-13)<br>error_complexity | The complexity of an attempted match against a regular expression exceeds a pre-set level[.](#tab:re.err-row-13-column-2-sentence-1) |
|
||
| [ð](#tab:re.err-row-14)<br>error_stack | There is insufficient memory to determine whether the regular expression matches the specified character sequence[.](#tab:re.err-row-14-column-2-sentence-1) |
|
||
|
||
### [28.6.5](#badexp) Class regex_error [[re.badexp]](re.badexp)
|
||
|
||
[ð](#lib:regex_error)
|
||
|
||
namespace std {class regex_error : public runtime_error {public:explicit regex_error(regex_constants::error_type ecode);
|
||
regex_constants::error_type code() const; };}
|
||
|
||
[1](#badexp-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9968)
|
||
|
||
The class regex_error defines the type of objects thrown as
|
||
exceptions to report errors from the regular expression library[.](#badexp-1.sentence-1)
|
||
|
||
[ð](#lib:regex_error,constructor)
|
||
|
||
`regex_error(regex_constants::error_type ecode);
|
||
`
|
||
|
||
[2](#badexp-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9978)
|
||
|
||
*Postconditions*: ecode == code()[.](#badexp-2.sentence-1)
|
||
|
||
[ð](#lib:error_type__)
|
||
|
||
`regex_constants::error_type code() const;
|
||
`
|
||
|
||
[3](#badexp-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9990)
|
||
|
||
*Returns*: The error code that was passed to the constructor[.](#badexp-3.sentence-1)
|
||
|
||
### [28.6.6](#traits) Class template regex_traits [[re.traits]](re.traits)
|
||
|
||
[ð](#lib:regex_traits)
|
||
|
||
namespace std {template<class charT>struct regex_traits {using char_type = charT; using string_type = basic_string<char_type>; using locale_type = locale; using char_class_type = *bitmask_type*;
|
||
|
||
regex_traits(); static size_t length(const char_type* p);
|
||
charT translate(charT c) const;
|
||
charT translate_nocase(charT c) const; template<class ForwardIterator> string_type transform(ForwardIterator first, ForwardIterator last) const; template<class ForwardIterator> string_type transform_primary( ForwardIterator first, ForwardIterator last) const; template<class ForwardIterator> string_type lookup_collatename( ForwardIterator first, ForwardIterator last) const; template<class ForwardIterator> char_class_type lookup_classname( ForwardIterator first, ForwardIterator last, bool icase = false) const; bool isctype(charT c, char_class_type f) const; int value(charT ch, int radix) const;
|
||
locale_type imbue(locale_type l);
|
||
locale_type getloc() const; };}
|
||
|
||
[1](#traits-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10029)
|
||
|
||
The specializations regex_traits<char> andregex_traits<wchar_t> meet the
|
||
requirements for a regular expression traits class ([[re.req]](#req "28.6.2 Requirements"))[.](#traits-1.sentence-1)
|
||
|
||
[ð](#lib:regex_traits,char_class_type)
|
||
|
||
`using char_class_type = bitmask_type;
|
||
`
|
||
|
||
[2](#traits-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10042)
|
||
|
||
The type char_class_type is used to represent a character
|
||
classification and is capable of holding an implementation specific
|
||
set returned by lookup_classname[.](#traits-2.sentence-1)
|
||
|
||
[ð](#lib:length,regex_traits)
|
||
|
||
`static size_t length(const char_type* p);
|
||
`
|
||
|
||
[3](#traits-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10054)
|
||
|
||
*Returns*: char_traits<charT>::length(p)[.](#traits-3.sentence-1)
|
||
|
||
[ð](#lib:regex_traits,translate)
|
||
|
||
`charT translate(charT c) const;
|
||
`
|
||
|
||
[4](#traits-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10065)
|
||
|
||
*Returns*: c[.](#traits-4.sentence-1)
|
||
|
||
[ð](#lib:regex_traits,translate_nocase)
|
||
|
||
`charT translate_nocase(charT c) const;
|
||
`
|
||
|
||
[5](#traits-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10076)
|
||
|
||
*Returns*: use_facet<ctype<charT>>(getloc()).tolower(c)[.](#traits-5.sentence-1)
|
||
|
||
[ð](#lib:regex_traits,transform)
|
||
|
||
`template<class ForwardIterator>
|
||
string_type transform(ForwardIterator first, ForwardIterator last) const;
|
||
`
|
||
|
||
[6](#traits-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10088)
|
||
|
||
*Effects*: As if by:string_type str(first, last);return use_facet<collate<charT>>( getloc()).transform(str.data(), str.data() + str.length());
|
||
|
||
[ð](#lib:regex_traits,transform_primary)
|
||
|
||
`template<class ForwardIterator>
|
||
string_type transform_primary(ForwardIterator first, ForwardIterator last) const;
|
||
`
|
||
|
||
[7](#traits-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10105)
|
||
|
||
*Effects*: Iftypeid(use_facet<collate<charT>>(getloc())) == typeid(collate_byname<charT>) and the form of the sort key returned
|
||
by collate_byname<charT>::transform(first, last) is known and
|
||
can be converted into a primary sort key then returns that key,
|
||
otherwise returns an empty string[.](#traits-7.sentence-1)
|
||
|
||
[ð](#lib:regex_traits,lookup_collatename)
|
||
|
||
`template<class ForwardIterator>
|
||
string_type lookup_collatename(ForwardIterator first, ForwardIterator last) const;
|
||
`
|
||
|
||
[8](#traits-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10124)
|
||
|
||
*Returns*: A sequence of one or more characters that
|
||
represents the collating element consisting of the character
|
||
sequence designated by the iterator range [first, last)[.](#traits-8.sentence-1)
|
||
|
||
Returns an empty string if the character sequence is not a
|
||
valid collating element[.](#traits-8.sentence-2)
|
||
|
||
[ð](#lib:regex_traits,lookup_classname)
|
||
|
||
`template<class ForwardIterator>
|
||
char_class_type lookup_classname(
|
||
ForwardIterator first, ForwardIterator last, bool icase = false) const;
|
||
`
|
||
|
||
[9](#traits-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10141)
|
||
|
||
*Returns*: An unspecified value that represents
|
||
the character classification named by the character sequence
|
||
designated by the iterator range [first, last)[.](#traits-9.sentence-1)
|
||
|
||
If the parameter icase is true then the returned mask identifies the
|
||
character classification without regard to the case of the characters being
|
||
matched, otherwise it does honor the case of the characters being
|
||
matched[.](#traits-9.sentence-2)[238](#footnote-238 "For example, if the parameter icase is true then [[:lower:]] is the same as [[:alpha:]].")
|
||
|
||
The value
|
||
returned shall be independent of the case of the characters in
|
||
the character sequence[.](#traits-9.sentence-3)
|
||
|
||
If the name
|
||
is not recognized then returns char_class_type()[.](#traits-9.sentence-4)
|
||
|
||
[10](#traits-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10159)
|
||
|
||
*Remarks*: For regex_traits<char>, at least the narrow character names
|
||
in Table [121](#tab:re.traits.classnames "Table 121: Character class names and corresponding ctype masks") shall be recognized[.](#traits-10.sentence-1)
|
||
|
||
For regex_traits<wchar_t>, at least the wide character names
|
||
in Table [121](#tab:re.traits.classnames "Table 121: Character class names and corresponding ctype masks") shall be recognized[.](#traits-10.sentence-2)
|
||
|
||
[ð](#lib:regex_traits,isctype)
|
||
|
||
`bool isctype(charT c, char_class_type f) const;
|
||
`
|
||
|
||
[11](#traits-11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10173)
|
||
|
||
*Effects*: Determines if the character c is a member of the character
|
||
classification represented by f[.](#traits-11.sentence-1)
|
||
|
||
[12](#traits-12)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10178)
|
||
|
||
*Returns*: Given the following function declaration:// for exposition onlytemplate<class C> ctype_base::mask convert(typename regex_traits<C>::char_class_type f); that returns a value in which each ctype_base::mask value corresponding to
|
||
a value in f named in Table [121](#tab:re.traits.classnames "Table 121: Character class names and corresponding ctype masks") is set, then the
|
||
result is determined as if by:ctype_base::mask m = convert<charT>(f);const ctype<charT>& ct = use_facet<ctype<charT>>(getloc());if (ct.is(m, c)) {return true;} else if (c == ct.widen('_')) { charT w[1] = { ct.widen('w') };
|
||
char_class_type x = lookup_classname(w, w+1); return (f&x) == x;} else {return false;}
|
||
|
||
[*Example [1](#traits-example-1)*: regex_traits<char> t;
|
||
string d("d");
|
||
string u("upper");
|
||
regex_traits<char>::char_class_type f;
|
||
f = t.lookup_classname(d.begin(), d.end());
|
||
f |= t.lookup_classname(u.begin(), u.end());
|
||
ctype_base::mask m = convert<char>(f); // m == ctype_base::digit | ctype_base::upper â *end example*]
|
||
|
||
[*Example [2](#traits-example-2)*: regex_traits<char> t;
|
||
string w("w");
|
||
regex_traits<char>::char_class_type f;
|
||
f = t.lookup_classname(w.begin(), w.end());
|
||
t.isctype('A', f); // returns true t.isctype('_', f); // returns true t.isctype(' ', f); // returns false â *end example*]
|
||
|
||
[ð](#lib:value,regex_traits)
|
||
|
||
`int value(charT ch, int radix) const;
|
||
`
|
||
|
||
[13](#traits-13)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10232)
|
||
|
||
*Preconditions*: The value of radix is 8, 10, or 16[.](#traits-13.sentence-1)
|
||
|
||
[14](#traits-14)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10236)
|
||
|
||
*Returns*: The value represented by the digit ch in baseradix if the character ch is a valid digit in baseradix; otherwise returns -1[.](#traits-14.sentence-1)
|
||
|
||
[ð](#lib:locale)
|
||
|
||
`locale_type imbue(locale_type loc);
|
||
`
|
||
|
||
[15](#traits-15)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10250)
|
||
|
||
*Effects*: Imbues *this with a copy of the
|
||
locale loc[.](#traits-15.sentence-1)
|
||
|
||
[*Note [1](#traits-note-1)*:
|
||
|
||
Calling imbue with a
|
||
different locale than the one currently in use invalidates all cached
|
||
data held by *this[.](#traits-15.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
[16](#traits-16)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10260)
|
||
|
||
*Postconditions*: getloc() == loc[.](#traits-16.sentence-1)
|
||
|
||
[17](#traits-17)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10264)
|
||
|
||
*Returns*: If no locale has been previously imbued then a copy of the
|
||
global locale in effect at the time of construction of *this,
|
||
otherwise a copy of the last argument passed to imbue[.](#traits-17.sentence-1)
|
||
|
||
[ð](#lib:locale_)
|
||
|
||
`locale_type getloc() const;
|
||
`
|
||
|
||
[18](#traits-18)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10278)
|
||
|
||
*Returns*: If no locale has been imbued then a copy of the global locale
|
||
in effect at the time of construction of *this, otherwise a copy of
|
||
the last argument passed to imbue[.](#traits-18.sentence-1)
|
||
|
||
Table [121](#tab:re.traits.classnames) — Character class names and corresponding ctype masks [[tab:re.traits.classnames]](./tab:re.traits.classnames)
|
||
|
||
| [ð](#tab:re.traits.classnames-row-1)<br>**Narrow character name** | **Wide character name** | **Corresponding ctype_base::mask value** |
|
||
| --- | --- | --- |
|
||
| [ð](#tab:re.traits.classnames-row-2)<br>"alnum" | L"alnum" | ctype_base::alnum |
|
||
| [ð](#tab:re.traits.classnames-row-3)<br>"alpha" | L"alpha" | ctype_base::alpha |
|
||
| [ð](#tab:re.traits.classnames-row-4)<br>"blank" | L"blank" | ctype_base::blank |
|
||
| [ð](#tab:re.traits.classnames-row-5)<br>"cntrl" | L"cntrl" | ctype_base::cntrl |
|
||
| [ð](#tab:re.traits.classnames-row-6)<br>"digit" | L"digit" | ctype_base::digit |
|
||
| [ð](#tab:re.traits.classnames-row-7)<br>"d" | L"d" | ctype_base::digit |
|
||
| [ð](#tab:re.traits.classnames-row-8)<br>"graph" | L"graph" | ctype_base::graph |
|
||
| [ð](#tab:re.traits.classnames-row-9)<br>"lower" | L"lower" | ctype_base::lower |
|
||
| [ð](#tab:re.traits.classnames-row-10)<br>"print" | L"print" | ctype_base::print |
|
||
| [ð](#tab:re.traits.classnames-row-11)<br>"punct" | L"punct" | ctype_base::punct |
|
||
| [ð](#tab:re.traits.classnames-row-12)<br>"space" | L"space" | ctype_base::space |
|
||
| [ð](#tab:re.traits.classnames-row-13)<br>"s" | L"s" | ctype_base::space |
|
||
| [ð](#tab:re.traits.classnames-row-14)<br>"upper" | L"upper" | ctype_base::upper |
|
||
| [ð](#tab:re.traits.classnames-row-15)<br>"w" | L"w" | ctype_base::alnum |
|
||
| [ð](#tab:re.traits.classnames-row-16)<br>"xdigit" | L"xdigit" | ctype_base::xdigit |
|
||
|
||
[238)](#footnote-238)[238)](#footnoteref-238)
|
||
|
||
For example, if the parameter icase is true then[[:lower:]] is the same as [[:alpha:]][.](#footnote-238.sentence-1)
|
||
|
||
### [28.6.7](#regex) Class template basic_regex [[re.regex]](re.regex)
|
||
|
||
#### [28.6.7.1](#regex.general) General [[re.regex.general]](re.regex.general)
|
||
|
||
[1](#regex.general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10310)
|
||
|
||
For a char-like type charT, specializations of class
|
||
template basic_regex represent regular expressions constructed
|
||
from character sequences of charT characters[.](#regex.general-1.sentence-1)
|
||
|
||
In the rest
|
||
of [[re.regex]](#regex "28.6.7 Class template basic_regex"), charT denotes a given char-like
|
||
type[.](#regex.general-1.sentence-2)
|
||
|
||
Storage for a regular expression is allocated and freed as
|
||
necessary by the member functions of class basic_regex[.](#regex.general-1.sentence-3)
|
||
|
||
[2](#regex.general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10318)
|
||
|
||
Objects of type specialization of basic_regex are responsible for
|
||
converting the sequence of charT objects to an internal
|
||
representation[.](#regex.general-2.sentence-1)
|
||
|
||
It is not specified what form this representation
|
||
takes, nor how it is accessed by algorithms that operate on regular
|
||
expressions[.](#regex.general-2.sentence-2)
|
||
|
||
[*Note [1](#regex.general-note-1)*:
|
||
|
||
Implementations will typically declare
|
||
some function templates as friends of basic_regex to achieve
|
||
this[.](#regex.general-2.sentence-3)
|
||
|
||
â *end note*]
|
||
|
||
[3](#regex.general-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10330)
|
||
|
||
The functions described in [[re.regex]](#regex "28.6.7 Class template basic_regex") report errors by throwing
|
||
exceptions of type regex_error[.](#regex.general-3.sentence-1)
|
||
|
||
[ð](#lib:basic_regex__)
|
||
|
||
namespace std {template<class charT, class traits = regex_traits<charT>>class basic_regex {public:// typesusing value_type = charT; using traits_type = traits; using string_type = typename traits::string_type; using flag_type = regex_constants::syntax_option_type; using locale_type = typename traits::locale_type; // [[re.synopt]](#synopt "28.6.4.2 Bitmask type syntax_option_type"), constantsstatic constexpr flag_type icase = regex_constants::icase; static constexpr flag_type nosubs = regex_constants::nosubs; static constexpr flag_type optimize = regex_constants::optimize; static constexpr flag_type collate = regex_constants::collate; static constexpr flag_type ECMAScript = regex_constants::ECMAScript; static constexpr flag_type basic = regex_constants::basic; static constexpr flag_type extended = regex_constants::extended; static constexpr flag_type awk = regex_constants::awk; static constexpr flag_type grep = regex_constants::grep; static constexpr flag_type egrep = regex_constants::egrep; static constexpr flag_type multiline = regex_constants::multiline; // [[re.regex.construct]](#regex.construct "28.6.7.2 Constructors"), construct/copy/destroy basic_regex(); explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
|
||
basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
|
||
basic_regex(const basic_regex&);
|
||
basic_regex(basic_regex&&) noexcept; template<class ST, class SA>explicit basic_regex(const basic_string<charT, ST, SA>& s,
|
||
flag_type f = regex_constants::ECMAScript); template<class ForwardIterator> basic_regex(ForwardIterator first, ForwardIterator last,
|
||
flag_type f = regex_constants::ECMAScript);
|
||
basic_regex(initializer_list<charT> il, flag_type f = regex_constants::ECMAScript); ~basic_regex(); // [[re.regex.assign]](#regex.assign "28.6.7.3 Assignment"), assign basic_regex& operator=(const basic_regex& e);
|
||
basic_regex& operator=(basic_regex&& e) noexcept;
|
||
basic_regex& operator=(const charT* p);
|
||
basic_regex& operator=(initializer_list<charT> il); template<class ST, class SA> basic_regex& operator=(const basic_string<charT, ST, SA>& s);
|
||
|
||
basic_regex& assign(const basic_regex& e);
|
||
basic_regex& assign(basic_regex&& e) noexcept;
|
||
basic_regex& assign(const charT* p, flag_type f = regex_constants::ECMAScript);
|
||
basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript); template<class ST, class SA> basic_regex& assign(const basic_string<charT, ST, SA>& s,
|
||
flag_type f = regex_constants::ECMAScript); template<class InputIterator> basic_regex& assign(InputIterator first, InputIterator last,
|
||
flag_type f = regex_constants::ECMAScript);
|
||
basic_regex& assign(initializer_list<charT>,
|
||
flag_type f = regex_constants::ECMAScript); // [[re.regex.operations]](#regex.operations "28.6.7.4 Constant operations"), const operationsunsigned mark_count() const;
|
||
flag_type flags() const; // [[re.regex.locale]](#regex.locale "28.6.7.5 Locale"), locale locale_type imbue(locale_type loc);
|
||
locale_type getloc() const; // [[re.regex.swap]](#regex.swap "28.6.7.6 Swap"), swapvoid swap(basic_regex&); }; template<class ForwardIterator> basic_regex(ForwardIterator, ForwardIterator,
|
||
regex_constants::syntax_option_type = regex_constants::ECMAScript)-> basic_regex<typename iterator_traits<ForwardIterator>::value_type>;}
|
||
|
||
#### [28.6.7.2](#regex.construct) Constructors [[re.regex.construct]](re.regex.construct)
|
||
|
||
[ð](#lib:basic_regex,constructor)
|
||
|
||
`basic_regex();
|
||
`
|
||
|
||
[1](#regex.construct-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10425)
|
||
|
||
*Postconditions*: *this does not match any character sequence[.](#regex.construct-1.sentence-1)
|
||
|
||
[ð](#lib:basic_regex,constructor_)
|
||
|
||
`explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[2](#regex.construct-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10436)
|
||
|
||
*Preconditions*: [p, p + char_traits<charT>::length(p)) is a valid range[.](#regex.construct-2.sentence-1)
|
||
|
||
[3](#regex.construct-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10440)
|
||
|
||
*Effects*: The object's internal finite state machine
|
||
is constructed from the regular expression contained in
|
||
the sequence of characters
|
||
[p, p + char_traits<charT>::length(p)), and
|
||
interpreted according to the flags f[.](#regex.construct-3.sentence-1)
|
||
|
||
[4](#regex.construct-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10448)
|
||
|
||
*Postconditions*: flags() returns f[.](#regex.construct-4.sentence-1)
|
||
|
||
mark_count() returns the number of marked sub-expressions
|
||
within the expression[.](#regex.construct-4.sentence-2)
|
||
|
||
[5](#regex.construct-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10454)
|
||
|
||
*Throws*: regex_error if
|
||
[p, p + char_traits<charT>::length(p)) is not a valid regular expression[.](#regex.construct-5.sentence-1)
|
||
|
||
[ð](#lib:basic_regex,constructor__)
|
||
|
||
`basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[6](#regex.construct-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10466)
|
||
|
||
*Preconditions*: [p, p + len) is a valid range[.](#regex.construct-6.sentence-1)
|
||
|
||
[7](#regex.construct-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10470)
|
||
|
||
*Effects*: The object's internal finite state machine
|
||
is constructed from the regular expression contained in
|
||
the sequence of characters [p, p + len), and
|
||
interpreted according the flags specified in f[.](#regex.construct-7.sentence-1)
|
||
|
||
[8](#regex.construct-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10477)
|
||
|
||
*Postconditions*: flags() returns f[.](#regex.construct-8.sentence-1)
|
||
|
||
mark_count() returns the number of marked sub-expressions
|
||
within the expression[.](#regex.construct-8.sentence-2)
|
||
|
||
[9](#regex.construct-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10483)
|
||
|
||
*Throws*: regex_error if [p, p + len) is not a valid regular expression[.](#regex.construct-9.sentence-1)
|
||
|
||
[ð](#lib:basic_regex,constructor___)
|
||
|
||
`basic_regex(const basic_regex& e);
|
||
`
|
||
|
||
[10](#regex.construct-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10494)
|
||
|
||
*Postconditions*: flags() and mark_count() returne.flags() and e.mark_count(), respectively[.](#regex.construct-10.sentence-1)
|
||
|
||
[ð](#lib:basic_regex,constructor____)
|
||
|
||
`basic_regex(basic_regex&& e) noexcept;
|
||
`
|
||
|
||
[11](#regex.construct-11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10506)
|
||
|
||
*Postconditions*: flags() and mark_count() return the values thate.flags() and e.mark_count(), respectively, had before construction[.](#regex.construct-11.sentence-1)
|
||
|
||
[ð](#lib:basic_regex,constructor_____)
|
||
|
||
`template<class ST, class SA>
|
||
explicit basic_regex(const basic_string<charT, ST, SA>& s,
|
||
flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[12](#regex.construct-12)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10520)
|
||
|
||
*Effects*: The object's internal finite state machine
|
||
is constructed from the regular expression contained in
|
||
the string s, and
|
||
interpreted according to the flags specified in f[.](#regex.construct-12.sentence-1)
|
||
|
||
[13](#regex.construct-13)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10527)
|
||
|
||
*Postconditions*: flags() returns f[.](#regex.construct-13.sentence-1)
|
||
|
||
mark_count() returns the number of marked sub-expressions
|
||
within the expression[.](#regex.construct-13.sentence-2)
|
||
|
||
[14](#regex.construct-14)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10533)
|
||
|
||
*Throws*: regex_error if s is not a valid regular expression[.](#regex.construct-14.sentence-1)
|
||
|
||
[ð](#lib:basic_regex,constructor______)
|
||
|
||
`template<class ForwardIterator>
|
||
basic_regex(ForwardIterator first, ForwardIterator last,
|
||
flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[15](#regex.construct-15)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10546)
|
||
|
||
*Effects*: The object's internal finite state machine
|
||
is constructed from the regular expression contained in
|
||
the sequence of characters [first, last), and
|
||
interpreted according to the flags specified in f[.](#regex.construct-15.sentence-1)
|
||
|
||
[16](#regex.construct-16)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10553)
|
||
|
||
*Postconditions*: flags() returns f[.](#regex.construct-16.sentence-1)
|
||
|
||
mark_count() returns the number of marked sub-expressions
|
||
within the expression[.](#regex.construct-16.sentence-2)
|
||
|
||
[17](#regex.construct-17)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10559)
|
||
|
||
*Throws*: regex_error if the sequence [first, last) is not a
|
||
valid regular expression[.](#regex.construct-17.sentence-1)
|
||
|
||
[ð](#lib:basic_regex,constructor_______)
|
||
|
||
`basic_regex(initializer_list<charT> il, flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[18](#regex.construct-18)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10571)
|
||
|
||
*Effects*: Same as basic_regex(il.begin(), il.end(), f)[.](#regex.construct-18.sentence-1)
|
||
|
||
#### [28.6.7.3](#regex.assign) Assignment [[re.regex.assign]](re.regex.assign)
|
||
|
||
[ð](#lib:basic_regex,operator=)
|
||
|
||
`basic_regex& operator=(const basic_regex& e);
|
||
`
|
||
|
||
[1](#regex.assign-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10584)
|
||
|
||
*Postconditions*: flags() and mark_count() returne.flags() and e.mark_count(), respectively[.](#regex.assign-1.sentence-1)
|
||
|
||
[ð](#lib:basic_regex,operator=_)
|
||
|
||
`basic_regex& operator=(basic_regex&& e) noexcept;
|
||
`
|
||
|
||
[2](#regex.assign-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10596)
|
||
|
||
*Postconditions*: flags() and mark_count() return the values thate.flags() and e.mark_count(), respectively, had before assignment[.](#regex.assign-2.sentence-1)
|
||
|
||
e is in a valid state with unspecified value[.](#regex.assign-2.sentence-2)
|
||
|
||
[ð](#lib:basic_regex,operator=__)
|
||
|
||
`basic_regex& operator=(const charT* p);
|
||
`
|
||
|
||
[3](#regex.assign-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10609)
|
||
|
||
*Effects*: Equivalent to: return assign(p);
|
||
|
||
[ð](#lib:basic_regex,operator=___)
|
||
|
||
`basic_regex& operator=(initializer_list<charT> il);
|
||
`
|
||
|
||
[4](#regex.assign-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10620)
|
||
|
||
*Effects*: Equivalent to: return assign(il.begin(), il.end());
|
||
|
||
[ð](#lib:basic_regex,operator=____)
|
||
|
||
`template<class ST, class SA>
|
||
basic_regex& operator=(const basic_string<charT, ST, SA>& s);
|
||
`
|
||
|
||
[5](#regex.assign-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10632)
|
||
|
||
*Effects*: Equivalent to: return assign(s);
|
||
|
||
[ð](#lib:basic_regex,assign)
|
||
|
||
`basic_regex& assign(const basic_regex& e);
|
||
`
|
||
|
||
[6](#regex.assign-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10643)
|
||
|
||
*Effects*: Equivalent to: return *this = e;
|
||
|
||
[ð](#lib:basic_regex,assign_)
|
||
|
||
`basic_regex& assign(basic_regex&& e) noexcept;
|
||
`
|
||
|
||
[7](#regex.assign-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10654)
|
||
|
||
*Effects*: Equivalent to: return *this = std::move(e);
|
||
|
||
[ð](#lib:basic_regex,assign__)
|
||
|
||
`basic_regex& assign(const charT* p, flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[8](#regex.assign-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10665)
|
||
|
||
*Effects*: Equivalent to: return assign(string_type(p), f);
|
||
|
||
[ð](#lib:basic_regex,assign___)
|
||
|
||
`basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[9](#regex.assign-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10676)
|
||
|
||
*Effects*: Equivalent to: return assign(string_type(p, len), f);
|
||
|
||
[ð](#lib:basic_regex,assign____)
|
||
|
||
`template<class ST, class SA>
|
||
basic_regex& assign(const basic_string<charT, ST, SA>& s,
|
||
flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[10](#regex.assign-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10689)
|
||
|
||
*Effects*: Assigns the regular expression contained in the strings, interpreted according the flags specified in f[.](#regex.assign-10.sentence-1)
|
||
|
||
If an exception is thrown, *this is unchanged[.](#regex.assign-10.sentence-2)
|
||
|
||
[11](#regex.assign-11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10695)
|
||
|
||
*Postconditions*: If no exception is thrown,flags() returns f and mark_count() returns the number of marked sub-expressions within the expression[.](#regex.assign-11.sentence-1)
|
||
|
||
[12](#regex.assign-12)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10701)
|
||
|
||
*Returns*: *this[.](#regex.assign-12.sentence-1)
|
||
|
||
[13](#regex.assign-13)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10705)
|
||
|
||
*Throws*: regex_error if s is not a valid regular expression[.](#regex.assign-13.sentence-1)
|
||
|
||
[ð](#lib:basic_regex,assign_____)
|
||
|
||
`template<class InputIterator>
|
||
basic_regex& assign(InputIterator first, InputIterator last,
|
||
flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[14](#regex.assign-14)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10718)
|
||
|
||
*Effects*: Equivalent to: return assign(string_type(first, last), f);
|
||
|
||
[ð](#lib:assign,basic_regex______)
|
||
|
||
`basic_regex& assign(initializer_list<charT> il,
|
||
flag_type f = regex_constants::ECMAScript);
|
||
`
|
||
|
||
[15](#regex.assign-15)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10730)
|
||
|
||
*Effects*: Equivalent to: return assign(il.begin(), il.end(), f);
|
||
|
||
#### [28.6.7.4](#regex.operations) Constant operations [[re.regex.operations]](re.regex.operations)
|
||
|
||
[ð](#lib:mark_count,basic_regex)
|
||
|
||
`unsigned mark_count() const;
|
||
`
|
||
|
||
[1](#regex.operations-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10744)
|
||
|
||
*Effects*: Returns the number of marked sub-expressions within the
|
||
regular expression[.](#regex.operations-1.sentence-1)
|
||
|
||
[ð](#lib:flag_type,basic_regex)
|
||
|
||
`flag_type flags() const;
|
||
`
|
||
|
||
[2](#regex.operations-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10756)
|
||
|
||
*Effects*: Returns a copy of the regular expression syntax flags that
|
||
were passed to the object's constructor or to the last call
|
||
to assign[.](#regex.operations-2.sentence-1)
|
||
|
||
#### [28.6.7.5](#regex.locale) Locale [[re.regex.locale]](re.regex.locale)
|
||
|
||
[ð](#lib:imbue,basic_regex)
|
||
|
||
`locale_type imbue(locale_type loc);
|
||
`
|
||
|
||
[1](#regex.locale-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10772)
|
||
|
||
*Effects*: Returns the result of traits_inst.imbue(loc) wheretraits_inst is a (default-initialized) instance of the template
|
||
type argument traits stored within the object[.](#regex.locale-1.sentence-1)
|
||
|
||
After a call
|
||
to imbue the basic_regex object does not match any
|
||
character sequence[.](#regex.locale-1.sentence-2)
|
||
|
||
[ð](#lib:getloc,basic_regex)
|
||
|
||
`locale_type getloc() const;
|
||
`
|
||
|
||
[2](#regex.locale-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10787)
|
||
|
||
*Effects*: Returns the result of traits_inst.getloc() wheretraits_inst is a (default-initialized) instance of the template
|
||
parameter traits stored within the object[.](#regex.locale-2.sentence-1)
|
||
|
||
#### [28.6.7.6](#regex.swap) Swap [[re.regex.swap]](re.regex.swap)
|
||
|
||
[ð](#lib:swap,basic_regex_)
|
||
|
||
`void swap(basic_regex& e);
|
||
`
|
||
|
||
[1](#regex.swap-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10803)
|
||
|
||
*Effects*: Swaps the contents of the two regular expressions[.](#regex.swap-1.sentence-1)
|
||
|
||
[2](#regex.swap-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10807)
|
||
|
||
*Postconditions*: *this contains the regular expression
|
||
that was in e, e contains the regular expression that
|
||
was in *this[.](#regex.swap-2.sentence-1)
|
||
|
||
[3](#regex.swap-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10813)
|
||
|
||
*Complexity*: Constant time[.](#regex.swap-3.sentence-1)
|
||
|
||
#### [28.6.7.7](#regex.nonmemb) Non-member functions [[re.regex.nonmemb]](re.regex.nonmemb)
|
||
|
||
[ð](#lib:basic_regex,swap__)
|
||
|
||
`template<class charT, class traits>
|
||
void swap(basic_regex<charT, traits>& lhs, basic_regex<charT, traits>& rhs);
|
||
`
|
||
|
||
[1](#regex.nonmemb-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10827)
|
||
|
||
*Effects*: Calls lhs.swap(rhs)[.](#regex.nonmemb-1.sentence-1)
|
||
|
||
### [28.6.8](#submatch) Class template sub_match [[re.submatch]](re.submatch)
|
||
|
||
#### [28.6.8.1](#submatch.general) General [[re.submatch.general]](re.submatch.general)
|
||
|
||
[1](#submatch.general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10835)
|
||
|
||
Class template sub_match denotes the sequence of characters matched
|
||
by a particular marked sub-expression[.](#submatch.general-1.sentence-1)
|
||
|
||
namespace std {template<class BidirectionalIterator>class sub_match : public pair<BidirectionalIterator, BidirectionalIterator> {public:using value_type =typename iterator_traits<BidirectionalIterator>::value_type; using difference_type =typename iterator_traits<BidirectionalIterator>::difference_type; using iterator = BidirectionalIterator; using string_type = basic_string<value_type>; bool matched; constexpr sub_match();
|
||
|
||
difference_type length() const; operator string_type() const;
|
||
string_type str() const; int compare(const sub_match& s) const; int compare(const string_type& s) const; int compare(const value_type* s) const; void swap(sub_match& s) noexcept(*see below*); };}
|
||
|
||
#### [28.6.8.2](#submatch.members) Members [[re.submatch.members]](re.submatch.members)
|
||
|
||
[ð](#lib:sub_match,constructor)
|
||
|
||
`constexpr sub_match();
|
||
`
|
||
|
||
[1](#submatch.members-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10878)
|
||
|
||
*Effects*: Value-initializes the pair base class subobject and the membermatched[.](#submatch.members-1.sentence-1)
|
||
|
||
[ð](#lib:sub_match,length)
|
||
|
||
`difference_type length() const;
|
||
`
|
||
|
||
[2](#submatch.members-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10890)
|
||
|
||
*Returns*: matched ? distance(first, second) : 0[.](#submatch.members-2.sentence-1)
|
||
|
||
[ð](#lib:operator_basic_string,sub_match)
|
||
|
||
`operator string_type() const;
|
||
`
|
||
|
||
[3](#submatch.members-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10901)
|
||
|
||
*Returns*: matched ? string_type(first, second) : string_type()[.](#submatch.members-3.sentence-1)
|
||
|
||
[ð](#lib:sub_match,str)
|
||
|
||
`string_type str() const;
|
||
`
|
||
|
||
[4](#submatch.members-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10912)
|
||
|
||
*Returns*: matched ? string_type(first, second) : string_type()[.](#submatch.members-4.sentence-1)
|
||
|
||
[ð](#lib:sub_match,compare)
|
||
|
||
`int compare(const sub_match& s) const;
|
||
`
|
||
|
||
[5](#submatch.members-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10923)
|
||
|
||
*Returns*: str().compare(s.str())[.](#submatch.members-5.sentence-1)
|
||
|
||
[ð](#lib:sub_match,compare_)
|
||
|
||
`int compare(const string_type& s) const;
|
||
`
|
||
|
||
[6](#submatch.members-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10934)
|
||
|
||
*Returns*: str().compare(s)[.](#submatch.members-6.sentence-1)
|
||
|
||
[ð](#lib:sub_match,compare__)
|
||
|
||
`int compare(const value_type* s) const;
|
||
`
|
||
|
||
[7](#submatch.members-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10945)
|
||
|
||
*Returns*: str().compare(s)[.](#submatch.members-7.sentence-1)
|
||
|
||
[ð](#lib:sub_match,swap)
|
||
|
||
`void swap(sub_match& s) noexcept(see below);
|
||
`
|
||
|
||
[8](#submatch.members-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10956)
|
||
|
||
*Preconditions*: BidirectionalIterator meets
|
||
the *Cpp17Swappable* requirements ([[swappable.requirements]](swappable.requirements "16.4.4.3 Swappable requirements"))[.](#submatch.members-8.sentence-1)
|
||
|
||
[9](#submatch.members-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10961)
|
||
|
||
*Effects*: Equivalent to:this->pair<BidirectionalIterator, BidirectionalIterator>::swap(s);
|
||
std::swap(matched, s.matched);
|
||
|
||
[10](#submatch.members-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10969)
|
||
|
||
*Remarks*: The exception specification is equivalent tois_nothrow_swappable_v<BidirectionalIterator>[.](#submatch.members-10.sentence-1)
|
||
|
||
#### [28.6.8.3](#submatch.op) Non-member operators [[re.submatch.op]](re.submatch.op)
|
||
|
||
[1](#submatch.op-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10977)
|
||
|
||
Let *SM-CAT*(I) becompare_three_way_result_t<basic_string<typename iterator_traits<I>::value_type>>
|
||
|
||
[ð](#lib:sub_match,operator==)
|
||
|
||
`template<class BiIter>
|
||
bool operator==(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
|
||
`
|
||
|
||
[2](#submatch.op-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10990)
|
||
|
||
*Returns*: lhs.compare(rhs) == 0[.](#submatch.op-2.sentence-1)
|
||
|
||
[ð](#lib:sub_match,operator%3c=%3e)
|
||
|
||
`template<class BiIter>
|
||
auto operator<=>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
|
||
`
|
||
|
||
[3](#submatch.op-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11002)
|
||
|
||
*Returns*: static_cast<*SM-CAT*(BiIter)>(lhs.compare(rhs) <=> 0)[.](#submatch.op-3.sentence-1)
|
||
|
||
[ð](#lib:operator==,sub_match_)
|
||
|
||
`template<class BiIter, class ST, class SA>
|
||
bool operator==(
|
||
const sub_match<BiIter>& lhs,
|
||
const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
|
||
`
|
||
|
||
[4](#submatch.op-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11016)
|
||
|
||
*Returns*: lhs.compare(typename sub_match<BiIter>::string_type(rhs.data(), rhs.size())) == 0
|
||
|
||
[ð](#lib:operator%3c=%3e,sub_match_)
|
||
|
||
`template<class BiIter, class ST, class SA>
|
||
auto operator<=>(
|
||
const sub_match<BiIter>& lhs,
|
||
const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
|
||
`
|
||
|
||
[5](#submatch.op-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11032)
|
||
|
||
*Returns*: static_cast<*SM-CAT*(BiIter)>(lhs.compare(typename sub_match<BiIter>::string_type(rhs.data(), rhs.size()))<=> 0)
|
||
|
||
[ð](#lib:sub_match,operator==__)
|
||
|
||
`template<class BiIter>
|
||
bool operator==(const sub_match<BiIter>& lhs,
|
||
const typename iterator_traits<BiIter>::value_type* rhs);
|
||
`
|
||
|
||
[6](#submatch.op-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11050)
|
||
|
||
*Returns*: lhs.compare(rhs) == 0[.](#submatch.op-6.sentence-1)
|
||
|
||
[ð](#lib:sub_match,operator%3c=%3e__)
|
||
|
||
`template<class BiIter>
|
||
auto operator<=>(const sub_match<BiIter>& lhs,
|
||
const typename iterator_traits<BiIter>::value_type* rhs);
|
||
`
|
||
|
||
[7](#submatch.op-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11063)
|
||
|
||
*Returns*: static_cast<*SM-CAT*(BiIter)>(lhs.compare(rhs) <=> 0)[.](#submatch.op-7.sentence-1)
|
||
|
||
[ð](#lib:sub_match,operator==___)
|
||
|
||
`template<class BiIter>
|
||
bool operator==(const sub_match<BiIter>& lhs,
|
||
const typename iterator_traits<BiIter>::value_type& rhs);
|
||
`
|
||
|
||
[8](#submatch.op-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11076)
|
||
|
||
*Returns*: lhs.compare(typename sub_match<BiIter>::string_type(1, rhs)) == 0[.](#submatch.op-8.sentence-1)
|
||
|
||
[ð](#lib:sub_match,operator%3c=%3e___)
|
||
|
||
`template<class BiIter>
|
||
auto operator<=>(const sub_match<BiIter>& lhs,
|
||
const typename iterator_traits<BiIter>::value_type& rhs);
|
||
`
|
||
|
||
[9](#submatch.op-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11089)
|
||
|
||
*Returns*: static_cast<*SM-CAT*(BiIter)>(lhs.compare(typename sub_match<BiIter>::string_type(1, rhs))<=> 0)
|
||
|
||
[ð](#lib:basic_ostream)
|
||
|
||
`template<class charT, class ST, class BiIter>
|
||
basic_ostream<charT, ST>&
|
||
operator<<(basic_ostream<charT, ST>& os, const sub_match<BiIter>& m);
|
||
`
|
||
|
||
[10](#submatch.op-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11108)
|
||
|
||
*Returns*: os << m.str()[.](#submatch.op-10.sentence-1)
|
||
|
||
### [28.6.9](#results) Class template match_results [[re.results]](re.results)
|
||
|
||
#### [28.6.9.1](#results.general) General [[re.results.general]](re.results.general)
|
||
|
||
[1](#results.general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11116)
|
||
|
||
Class template match_results denotes a collection of character
|
||
sequences representing the result of a regular expression
|
||
match[.](#results.general-1.sentence-1)
|
||
|
||
Storage for the collection is allocated and freed as necessary
|
||
by the member functions of class template match_results[.](#results.general-1.sentence-2)
|
||
|
||
[2](#results.general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11123)
|
||
|
||
The class template match_results meets the requirements of an
|
||
allocator-aware container ([[container.alloc.reqmts]](container.alloc.reqmts "23.2.2.5 Allocator-aware containers")) and of
|
||
a sequence container ([[container.requirements.general]](container.requirements.general "23.2.2 General containers"), [[sequence.reqmts]](sequence.reqmts "23.2.4 Sequence containers"))
|
||
except that only
|
||
copy assignment,
|
||
move assignment, and
|
||
operations defined for const-qualified sequence containers
|
||
are supported and
|
||
that the semantics of the comparison operator functions are different from those
|
||
required for a container[.](#results.general-2.sentence-1)
|
||
|
||
[3](#results.general-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11137)
|
||
|
||
A default-constructed match_results object has no fully established result state[.](#results.general-3.sentence-1)
|
||
|
||
A
|
||
match result is [*ready*](futures.state#def:ready "32.10.5 Shared state [futures.state]") when, as a consequence of a completed regular expression match
|
||
modifying such an object, its result state becomes fully established[.](#results.general-3.sentence-2)
|
||
|
||
The effects of calling
|
||
most member functions from a match_results object that is not ready are undefined[.](#results.general-3.sentence-3)
|
||
|
||
[4](#results.general-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11143)
|
||
|
||
The sub_match object stored at index 0 represents sub-expression 0,
|
||
i.e., the whole match[.](#results.general-4.sentence-1)
|
||
|
||
In this case the sub_match membermatched is always true[.](#results.general-4.sentence-2)
|
||
|
||
The sub_match object stored at index n denotes what matched the marked
|
||
sub-expression n within the matched expression[.](#results.general-4.sentence-3)
|
||
|
||
If the
|
||
sub-expression n participated in a regular expression
|
||
match then the sub_match member matched evaluates to true, and
|
||
members first and second denote the range of characters
|
||
[first, second) which formed that
|
||
match[.](#results.general-4.sentence-4)
|
||
|
||
Otherwise matched is false, and members first and second point to the end of the sequence
|
||
that was searched[.](#results.general-4.sentence-5)
|
||
|
||
[*Note [1](#results.general-note-1)*:
|
||
|
||
The sub_match objects representing
|
||
different sub-expressions that did not participate in a regular expression
|
||
match need not be distinct[.](#results.general-4.sentence-6)
|
||
|
||
â *end note*]
|
||
|
||
namespace std {template<class BidirectionalIterator, class Allocator = allocator<sub_match<BidirectionalIterator>>>class match_results {public:using value_type = sub_match<BidirectionalIterator>; using const_reference = const value_type&; using reference = value_type&; using const_iterator = *implementation-defined*; using iterator = const_iterator; using difference_type =typename iterator_traits<BidirectionalIterator>::difference_type; using size_type = typename allocator_traits<Allocator>::size_type; using allocator_type = Allocator; using char_type =typename iterator_traits<BidirectionalIterator>::value_type; using string_type = basic_string<char_type>; // [[re.results.const]](#results.const "28.6.9.2 Constructors"), construct/copy/destroy match_results() : match_results(Allocator()) {}explicit match_results(const Allocator& a);
|
||
match_results(const match_results& m);
|
||
match_results(const match_results& m, const Allocator& a);
|
||
match_results(match_results&& m) noexcept;
|
||
match_results(match_results&& m, const Allocator& a);
|
||
match_results& operator=(const match_results& m);
|
||
match_results& operator=(match_results&& m); ~match_results(); // [[re.results.state]](#results.state "28.6.9.3 State"), statebool ready() const; // [[re.results.size]](#results.size "28.6.9.4 Size"), size size_type size() const;
|
||
size_type max_size() const; bool empty() const; // [[re.results.acc]](#results.acc "28.6.9.5 Element access"), element access difference_type length(size_type sub = 0) const;
|
||
difference_type position(size_type sub = 0) const;
|
||
string_type str(size_type sub = 0) const;
|
||
const_reference operator[](size_type n) const;
|
||
|
||
const_reference prefix() const;
|
||
const_reference suffix() const;
|
||
const_iterator begin() const;
|
||
const_iterator end() const;
|
||
const_iterator cbegin() const;
|
||
const_iterator cend() const; // [[re.results.form]](#results.form "28.6.9.6 Formatting"), formattemplate<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; 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; 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;
|
||
string_type
|
||
format(const char_type* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::format_default) const; // [[re.results.all]](#results.all "28.6.9.7 Allocator"), allocator allocator_type get_allocator() const; // [[re.results.swap]](#results.swap "28.6.9.8 Swap"), swapvoid swap(match_results& that); };}
|
||
|
||
#### [28.6.9.2](#results.const) Constructors [[re.results.const]](re.results.const)
|
||
|
||
[1](#results.const-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11244)
|
||
|
||
Table [122](#tab:re.results.const "Table 122: match_results copy/move operation postconditions") lists the postconditions ofmatch_results copy/move constructors and copy/move assignment operators[.](#results.const-1.sentence-1)
|
||
|
||
For move operations,
|
||
the results of the expressions depending on the parameter m denote
|
||
the values they had before the respective function calls[.](#results.const-1.sentence-2)
|
||
|
||
[ð](#lib:match_results,constructor)
|
||
|
||
`explicit match_results(const Allocator& a);
|
||
`
|
||
|
||
[2](#results.const-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11257)
|
||
|
||
*Effects*: The stored Allocator value is constructed from a[.](#results.const-2.sentence-1)
|
||
|
||
[3](#results.const-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11261)
|
||
|
||
*Postconditions*: ready() returns false[.](#results.const-3.sentence-1)
|
||
|
||
size() returns 0[.](#results.const-3.sentence-2)
|
||
|
||
[ð](#lib:match_results,constructor_)
|
||
|
||
`match_results(const match_results& m);
|
||
match_results(const match_results& m, const Allocator& a);
|
||
`
|
||
|
||
[4](#results.const-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11274)
|
||
|
||
*Effects*: For the first form,
|
||
the stored Allocator value is obtained
|
||
as specified in [[container.reqmts]](container.reqmts "23.2.2.2 Container requirements")[.](#results.const-4.sentence-1)
|
||
|
||
For the second form,
|
||
the stored Allocator value is constructed from a[.](#results.const-4.sentence-2)
|
||
|
||
[5](#results.const-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11282)
|
||
|
||
*Postconditions*: As specified in Table [122](#tab:re.results.const "Table 122: match_results copy/move operation postconditions")[.](#results.const-5.sentence-1)
|
||
|
||
[ð](#lib:match_results,constructor__)
|
||
|
||
`match_results(match_results&& m) noexcept;
|
||
match_results(match_results&& m, const Allocator& a);
|
||
`
|
||
|
||
[6](#results.const-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11294)
|
||
|
||
*Effects*: For the first form,
|
||
the stored Allocator value is move constructed from m.get_allocator()[.](#results.const-6.sentence-1)
|
||
|
||
For the second form,
|
||
the stored Allocator value is constructed from a[.](#results.const-6.sentence-2)
|
||
|
||
[7](#results.const-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11301)
|
||
|
||
*Postconditions*: As specified in Table [122](#tab:re.results.const "Table 122: match_results copy/move operation postconditions")[.](#results.const-7.sentence-1)
|
||
|
||
[8](#results.const-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11305)
|
||
|
||
*Throws*: The second form throws nothing ifa == m.get_allocator() is true[.](#results.const-8.sentence-1)
|
||
|
||
[ð](#lib:match_results,operator=)
|
||
|
||
`match_results& operator=(const match_results& m);
|
||
`
|
||
|
||
[9](#results.const-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11317)
|
||
|
||
*Postconditions*: As specified in Table [122](#tab:re.results.const "Table 122: match_results copy/move operation postconditions")[.](#results.const-9.sentence-1)
|
||
|
||
[ð](#lib:match_results,operator=_)
|
||
|
||
`match_results& operator=(match_results&& m);
|
||
`
|
||
|
||
[10](#results.const-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11328)
|
||
|
||
*Postconditions*: As specified in Table [122](#tab:re.results.const "Table 122: match_results copy/move operation postconditions")[.](#results.const-10.sentence-1)
|
||
|
||
Table [122](#tab:re.results.const) — match_results copy/move operation postconditions [[tab:re.results.const]](./tab:re.results.const)
|
||
|
||
| [ð](#tab:re.results.const-row-1)<br>**Element** | **Value** |
|
||
| --- | --- |
|
||
| [ð](#tab:re.results.const-row-2)<br>ready() | m.ready() |
|
||
| [ð](#tab:re.results.const-row-3)<br>size() | m.size() |
|
||
| [ð](#tab:re.results.const-row-4)<br>str(n) | m.str(n) for all non-negative integers n < m.size() |
|
||
| [ð](#tab:re.results.const-row-5)<br>prefix() | m.prefix() |
|
||
| [ð](#tab:re.results.const-row-6)<br>suffix() | m.suffix() |
|
||
| [ð](#tab:re.results.const-row-7)<br>(*this)[n] | m[n] for all non-negative integers n < m.size() |
|
||
| [ð](#tab:re.results.const-row-8)<br>length(n) | m.length(n) for all non-negative integers n < m.size() |
|
||
| [ð](#tab:re.results.const-row-9)<br>position(n) | m.position(n) for all non-negative integers n < m.size() |
|
||
|
||
#### [28.6.9.3](#results.state) State [[re.results.state]](re.results.state)
|
||
|
||
[ð](#lib:match_results,ready)
|
||
|
||
`bool ready() const;
|
||
`
|
||
|
||
[1](#results.state-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11354)
|
||
|
||
*Returns*: true if *this has a fully established result state, otherwisefalse[.](#results.state-1.sentence-1)
|
||
|
||
#### [28.6.9.4](#results.size) Size [[re.results.size]](re.results.size)
|
||
|
||
[ð](#lib:match_results,size)
|
||
|
||
`size_type size() const;
|
||
`
|
||
|
||
[1](#results.size-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11368)
|
||
|
||
*Returns*: One plus the number of marked sub-expressions in the
|
||
regular expression that was matched if *this represents the
|
||
result of a successful match[.](#results.size-1.sentence-1)
|
||
|
||
Otherwise returns 0[.](#results.size-1.sentence-2)
|
||
|
||
[*Note [1](#results.size-note-1)*:
|
||
|
||
The state of a match_results object can be modified
|
||
only by passing that object to regex_match or regex_search[.](#results.size-1.sentence-3)
|
||
|
||
Subclauses [[re.alg.match]](#alg.match "28.6.10.2 regex_match") and [[re.alg.search]](#alg.search "28.6.10.3 regex_search") specify the
|
||
effects of those algorithms on their match_results arguments[.](#results.size-1.sentence-4)
|
||
|
||
â *end note*]
|
||
|
||
[ð](#lib:match_results,max_size)
|
||
|
||
`size_type max_size() const;
|
||
`
|
||
|
||
[2](#results.size-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11387)
|
||
|
||
*Returns*: The maximum number of sub_match elements that can be
|
||
stored in *this[.](#results.size-2.sentence-1)
|
||
|
||
[ð](#lib:match_results,empty)
|
||
|
||
`bool empty() const;
|
||
`
|
||
|
||
[3](#results.size-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11399)
|
||
|
||
*Returns*: size() == 0[.](#results.size-3.sentence-1)
|
||
|
||
#### [28.6.9.5](#results.acc) Element access [[re.results.acc]](re.results.acc)
|
||
|
||
[ð](#lib:length,match_results)
|
||
|
||
`difference_type length(size_type sub = 0) const;
|
||
`
|
||
|
||
[1](#results.acc-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11412)
|
||
|
||
*Preconditions*: ready() == true[.](#results.acc-1.sentence-1)
|
||
|
||
[2](#results.acc-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11416)
|
||
|
||
*Returns*: (*this)[sub].length()[.](#results.acc-2.sentence-1)
|
||
|
||
[ð](#lib:position,match_results)
|
||
|
||
`difference_type position(size_type sub = 0) const;
|
||
`
|
||
|
||
[3](#results.acc-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11427)
|
||
|
||
*Preconditions*: ready() == true[.](#results.acc-3.sentence-1)
|
||
|
||
[4](#results.acc-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[.](#results.acc-4.sentence-1)
|
||
|
||
[ð](#lib:match_results,str)
|
||
|
||
`string_type str(size_type sub = 0) const;
|
||
`
|
||
|
||
[5](#results.acc-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11443)
|
||
|
||
*Preconditions*: ready() == true[.](#results.acc-5.sentence-1)
|
||
|
||
[6](#results.acc-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11447)
|
||
|
||
*Returns*: string_type((*this)[sub])[.](#results.acc-6.sentence-1)
|
||
|
||
[ð](#lib:match_results,operator%5b%5d)
|
||
|
||
`const_reference operator[](size_type n) const;
|
||
`
|
||
|
||
[7](#results.acc-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11458)
|
||
|
||
*Preconditions*: ready() == true[.](#results.acc-7.sentence-1)
|
||
|
||
[8](#results.acc-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[.](#results.acc-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[.](#results.acc-8.sentence-2)
|
||
|
||
Ifn >= size() then returns a sub_match object representing an
|
||
unmatched sub-expression[.](#results.acc-8.sentence-3)
|
||
|
||
[ð](#lib:match_results,prefix)
|
||
|
||
`const_reference prefix() const;
|
||
`
|
||
|
||
[9](#results.acc-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11478)
|
||
|
||
*Preconditions*: ready() == true[.](#results.acc-9.sentence-1)
|
||
|
||
[10](#results.acc-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[.](#results.acc-10.sentence-1)
|
||
|
||
[ð](#lib:match_results,suffix)
|
||
|
||
`const_reference suffix() const;
|
||
`
|
||
|
||
[11](#results.acc-11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11495)
|
||
|
||
*Preconditions*: ready() == true[.](#results.acc-11.sentence-1)
|
||
|
||
[12](#results.acc-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[.](#results.acc-12.sentence-1)
|
||
|
||
[ð](#lib:match_results,begin)
|
||
|
||
`const_iterator begin() const;
|
||
const_iterator cbegin() const;
|
||
`
|
||
|
||
[13](#results.acc-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[.](#results.acc-13.sentence-1)
|
||
|
||
[ð](#lib:match_results,end)
|
||
|
||
`const_iterator end() const;
|
||
const_iterator cend() const;
|
||
`
|
||
|
||
[14](#results.acc-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[.](#results.acc-14.sentence-1)
|
||
|
||
#### [28.6.9.6](#results.form) Formatting [[re.results.form]](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](#results.form-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"))[.](#results.form-1.sentence-1)
|
||
|
||
[2](#results.form-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11549)
|
||
|
||
*Effects*: Copies the character sequence [fmt_first, fmt_last) to
|
||
OutputIter out[.](#results.form-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[.](#results.form-2.sentence-2)
|
||
|
||
The bitmasks specified in flags determine which format
|
||
specifiers and escape sequences are recognized[.](#results.form-2.sentence-3)
|
||
|
||
[3](#results.form-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11558)
|
||
|
||
*Returns*: out[.](#results.form-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](#results.form-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](#results.form-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11590)
|
||
|
||
*Preconditions*: ready() == true[.](#results.form-5.sentence-1)
|
||
|
||
[6](#results.form-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](#results.form-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11602)
|
||
|
||
*Returns*: result[.](#results.form-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](#results.form-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11615)
|
||
|
||
*Preconditions*: ready() == true[.](#results.form-8.sentence-1)
|
||
|
||
[9](#results.form-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](#results.form-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11627)
|
||
|
||
*Returns*: result[.](#results.form-10.sentence-1)
|
||
|
||
#### [28.6.9.7](#results.all) Allocator [[re.results.all]](re.results.all)
|
||
|
||
[ð](#lib:get_allocator,match_results)
|
||
|
||
`allocator_type get_allocator() const;
|
||
`
|
||
|
||
[1](#results.all-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11640)
|
||
|
||
*Returns*: A copy of the Allocator that was passed to the object's constructor or, if that
|
||
allocator has been replaced, a copy of the most recent replacement[.](#results.all-1.sentence-1)
|
||
|
||
#### [28.6.9.8](#results.swap) Swap [[re.results.swap]](re.results.swap)
|
||
|
||
[ð](#lib:match_results,swap)
|
||
|
||
`void swap(match_results& that);
|
||
`
|
||
|
||
[1](#results.swap-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11654)
|
||
|
||
*Effects*: Swaps the contents of the two sequences[.](#results.swap-1.sentence-1)
|
||
|
||
[2](#results.swap-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11658)
|
||
|
||
*Postconditions*: *this contains the sequence of matched
|
||
sub-expressions that were in that, that contains the
|
||
sequence of matched sub-expressions that were in *this[.](#results.swap-2.sentence-1)
|
||
|
||
[3](#results.swap-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11664)
|
||
|
||
*Complexity*: Constant time[.](#results.swap-3.sentence-1)
|
||
|
||
[ð](#lib:match_results,swap_)
|
||
|
||
`template<class BidirectionalIterator, class Allocator>
|
||
void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||
match_results<BidirectionalIterator, Allocator>& m2);
|
||
`
|
||
|
||
[4](#results.swap-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11676)
|
||
|
||
*Effects*: As if by m1.swap(m2)[.](#results.swap-4.sentence-1)
|
||
|
||
#### [28.6.9.9](#results.nonmember) Non-member functions [[re.results.nonmember]](re.results.nonmember)
|
||
|
||
[ð](#lib:operator==,match_results)
|
||
|
||
`template<class BidirectionalIterator, class Allocator>
|
||
bool operator==(const match_results<BidirectionalIterator, Allocator>& m1,
|
||
const match_results<BidirectionalIterator, Allocator>& m2);
|
||
`
|
||
|
||
[1](#results.nonmember-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11690)
|
||
|
||
*Returns*: true if neither match result is ready, false if one match result is ready and the
|
||
other is not[.](#results.nonmember-1.sentence-1)
|
||
|
||
If both match results are ready, returns true only if
|
||
|
||
- [(1.1)](#results.nonmember-1.1)
|
||
|
||
m1.empty() && m2.empty(), or
|
||
|
||
- [(1.2)](#results.nonmember-1.2)
|
||
|
||
!m1.empty() && !m2.empty(), and the following conditions are satisfied:
|
||
* [(1.2.1)](#results.nonmember-1.2.1)
|
||
|
||
m1.prefix() == m2.prefix(),
|
||
|
||
* [(1.2.2)](#results.nonmember-1.2.2)
|
||
|
||
m1.size() == m2.size() && equal(m1.begin(), m1.end(), m2.begin()), and
|
||
|
||
* [(1.2.3)](#results.nonmember-1.2.3)
|
||
|
||
m1.suffix() == m2.suffix()[.](#results.nonmember-1.sentence-2)
|
||
|
||
[*Note [1](#results.nonmember-note-1)*:
|
||
|
||
The algorithm equal is defined in [[algorithms]](algorithms "26 Algorithms library")[.](#results.nonmember-1.sentence-3)
|
||
|
||
â *end note*]
|
||
|
||
### [28.6.10](#alg) Regular expression algorithms [[re.alg]](re.alg)
|
||
|
||
#### [28.6.10.1](#except) Exceptions [[re.except]](re.except)
|
||
|
||
[1](#except-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11719)
|
||
|
||
The algorithms described in subclause [[re.alg]](#alg "28.6.10 Regular expression algorithms") may throw an exception
|
||
of type regex_error[.](#except-1.sentence-1)
|
||
|
||
If such an exception e is thrown,e.code() shall return either regex_constants::error_complexity or regex_constants::error_stack[.](#except-1.sentence-2)
|
||
|
||
#### [28.6.10.2](#alg.match) regex_match [[re.alg.match]](re.alg.match)
|
||
|
||
[ð](#lib:regex_match)
|
||
|
||
`template<class BidirectionalIterator, class Allocator, class charT, class traits>
|
||
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
||
match_results<BidirectionalIterator, Allocator>& m,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[1](#alg.match-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11736)
|
||
|
||
*Preconditions*: BidirectionalIterator models[bidirectional_iterator](iterator.concept.bidir#concept:bidirectional_iterator "24.3.4.12 Concept bidirectional_iterator [iterator.concept.bidir]") ([[iterator.concept.bidir]](iterator.concept.bidir "24.3.4.12 Concept bidirectional_iterator"))[.](#alg.match-1.sentence-1)
|
||
|
||
[2](#alg.match-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11741)
|
||
|
||
*Effects*: Determines whether there is a match between the
|
||
regular expression e, and all of the character
|
||
sequence [first, last)[.](#alg.match-2.sentence-1)
|
||
|
||
The parameter flags is
|
||
used to control how the expression is matched against the character
|
||
sequence[.](#alg.match-2.sentence-2)
|
||
|
||
When determining if there is a match, only potential matches
|
||
that match the entire character sequence are considered[.](#alg.match-2.sentence-3)
|
||
|
||
Returns true if such a match exists, false otherwise[.](#alg.match-2.sentence-4)
|
||
|
||
[*Example [1](#alg.match-example-1)*: std::regex re("Get|GetValue");
|
||
std::cmatch m;
|
||
regex_search("GetValue", m, re); // returns true, and m[0] contains "Get" regex_match ("GetValue", m, re); // returns true, and m[0] contains "GetValue" regex_search("GetValues", m, re); // returns true, and m[0] contains "Get" regex_match ("GetValues", m, re); // returns false â *end example*]
|
||
|
||
[3](#alg.match-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11762)
|
||
|
||
*Postconditions*: m.ready() == true in all cases[.](#alg.match-3.sentence-1)
|
||
|
||
If the function returns false, then the effect
|
||
on parameter m is unspecified except that m.size() returns 0 and m.empty() returns true[.](#alg.match-3.sentence-2)
|
||
|
||
Otherwise the effects on parameter m are given in
|
||
Table [123](#tab:re.alg.match "Table 123: Effects of regex_match algorithm")[.](#alg.match-3.sentence-3)
|
||
|
||
Table [123](#tab:re.alg.match) — Effects of regex_match algorithm [[tab:re.alg.match]](./tab:re.alg.match)
|
||
|
||
| [ð](#tab:re.alg.match-row-1)<br>**Element** | **Value** |
|
||
| --- | --- |
|
||
| [ð](#tab:re.alg.match-row-2)<br>m.size() | 1 + e.mark_count() |
|
||
| [ð](#tab:re.alg.match-row-3)<br>m.empty() | false |
|
||
| [ð](#tab:re.alg.match-row-4)<br>m.prefix().first | first |
|
||
| [ð](#tab:re.alg.match-row-5)<br>m.prefix().second | first |
|
||
| [ð](#tab:re.alg.match-row-6)<br>m.prefix().matched | false |
|
||
| [ð](#tab:re.alg.match-row-7)<br>m.suffix().first | last |
|
||
| [ð](#tab:re.alg.match-row-8)<br>m.suffix().second | last |
|
||
| [ð](#tab:re.alg.match-row-9)<br>m.suffix().matched | false |
|
||
| [ð](#tab:re.alg.match-row-10)<br>m[0].first | first |
|
||
| [ð](#tab:re.alg.match-row-11)<br>m[0].second | last |
|
||
| [ð](#tab:re.alg.match-row-12)<br>m[0].matched | true |
|
||
| [ð](#tab:re.alg.match-row-13)<br>m[n].first | For all integers 0 < n < m.size(), the start of the sequence that matched sub-expression n[.](#tab:re.alg.match-row-13-column-2-sentence-1)<br>Alternatively, if sub-expression n did not participate in the match, then last[.](#tab:re.alg.match-row-13-column-2-sentence-2) |
|
||
| [ð](#tab:re.alg.match-row-14)<br>m[n].second | For all integers 0 < n < m.size(), the end of the sequence that matched sub-expression n[.](#tab:re.alg.match-row-14-column-2-sentence-1)<br>Alternatively, if sub-expression n did not participate in the match, then last[.](#tab:re.alg.match-row-14-column-2-sentence-2) |
|
||
| [ð](#tab:re.alg.match-row-15)<br>m[n].matched | For all integers 0 < n < m.size(), true if sub-expression n participated in the match, false otherwise[.](#tab:re.alg.match-row-15-column-2-sentence-1) |
|
||
|
||
[ð](#lib:regex_match_)
|
||
|
||
`template<class BidirectionalIterator, class charT, class traits>
|
||
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[4](#alg.match-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11847)
|
||
|
||
*Effects*: Behaves âas ifâ by constructing an instance ofmatch_results<BidirectionalIterator> what, and then
|
||
returning the result ofregex_match(first, last, what, e, flags)[.](#alg.match-4.sentence-1)
|
||
|
||
[ð](#lib:regex_match__)
|
||
|
||
`template<class charT, class Allocator, class traits>
|
||
bool regex_match(const charT* str,
|
||
match_results<const charT*, Allocator>& m,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[5](#alg.match-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11865)
|
||
|
||
*Returns*: regex_match(str, str + char_traits<charT>::length(str), m, e, flags)[.](#alg.match-5.sentence-1)
|
||
|
||
[ð](#lib:regex_match___)
|
||
|
||
`template<class ST, class SA, class Allocator, class charT, class traits>
|
||
bool regex_match(const basic_string<charT, ST, SA>& s,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>& m,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[6](#alg.match-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11881)
|
||
|
||
*Returns*: regex_match(s.begin(), s.end(), m, e, flags)[.](#alg.match-6.sentence-1)
|
||
|
||
[ð](#lib:regex_match____)
|
||
|
||
`template<class charT, class traits>
|
||
bool regex_match(const charT* str,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[7](#alg.match-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11895)
|
||
|
||
*Returns*: regex_match(str, str + char_traits<charT>::length(str), e, flags)[.](#alg.match-7.sentence-1)
|
||
|
||
[ð](#lib:regex_match_____)
|
||
|
||
`template<class ST, class SA, class charT, class traits>
|
||
bool regex_match(const basic_string<charT, ST, SA>& s,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[8](#alg.match-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11909)
|
||
|
||
*Returns*: regex_match(s.begin(), s.end(), e, flags)[.](#alg.match-8.sentence-1)
|
||
|
||
#### [28.6.10.3](#alg.search) regex_search [[re.alg.search]](re.alg.search)
|
||
|
||
[ð](#lib:regex_search)
|
||
|
||
`template<class BidirectionalIterator, class Allocator, class charT, class traits>
|
||
bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||
match_results<BidirectionalIterator, Allocator>& m,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[1](#alg.search-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11926)
|
||
|
||
*Preconditions*: BidirectionalIterator models[bidirectional_iterator](iterator.concept.bidir#concept:bidirectional_iterator "24.3.4.12 Concept bidirectional_iterator [iterator.concept.bidir]") ([[iterator.concept.bidir]](iterator.concept.bidir "24.3.4.12 Concept bidirectional_iterator"))[.](#alg.search-1.sentence-1)
|
||
|
||
[2](#alg.search-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11931)
|
||
|
||
*Effects*: Determines whether there is some sub-sequence within [first, last) that matches
|
||
the regular expression e[.](#alg.search-2.sentence-1)
|
||
|
||
The parameter flags is used to control how the
|
||
expression is matched against the character sequence[.](#alg.search-2.sentence-2)
|
||
|
||
Returns true if such a sequence
|
||
exists, false otherwise[.](#alg.search-2.sentence-3)
|
||
|
||
[3](#alg.search-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L11938)
|
||
|
||
*Postconditions*: m.ready() == true in all cases[.](#alg.search-3.sentence-1)
|
||
|
||
If the function returns false, then the effect
|
||
on parameter m is unspecified except that m.size() returns 0 and m.empty() returns true[.](#alg.search-3.sentence-2)
|
||
|
||
Otherwise
|
||
the effects on parameter m are given in Table [124](#tab:re.alg.search "Table 124: Effects of regex_search algorithm")[.](#alg.search-3.sentence-3)
|
||
|
||
Table [124](#tab:re.alg.search) — Effects of regex_search algorithm [[tab:re.alg.search]](./tab:re.alg.search)
|
||
|
||
| [ð](#tab:re.alg.search-row-1)<br>**Element** | **Value** |
|
||
| --- | --- |
|
||
| [ð](#tab:re.alg.search-row-2)<br>m.size() | 1 + e.mark_count() |
|
||
| [ð](#tab:re.alg.search-row-3)<br>m.empty() | false |
|
||
| [ð](#tab:re.alg.search-row-4)<br>m.prefix().first | first |
|
||
| [ð](#tab:re.alg.search-row-5)<br>m.prefix().second | m[0].first |
|
||
| [ð](#tab:re.alg.search-row-6)<br>m.prefix().matched | m.prefix().first != m.prefix().second |
|
||
| [ð](#tab:re.alg.search-row-7)<br>m.suffix().first | m[0].second |
|
||
| [ð](#tab:re.alg.search-row-8)<br>m.suffix().second | last |
|
||
| [ð](#tab:re.alg.search-row-9)<br>m.suffix().matched | m.suffix().first != m.suffix().second |
|
||
| [ð](#tab:re.alg.search-row-10)<br>m[0].first | The start of the sequence of characters that matched the regular expression |
|
||
| [ð](#tab:re.alg.search-row-11)<br>m[0].second | The end of the sequence of characters that matched the regular expression |
|
||
| [ð](#tab:re.alg.search-row-12)<br>m[0].matched | true |
|
||
| [ð](#tab:re.alg.search-row-13)<br>m[n].first | For all integers 0 < n < m.size(), the start of the sequence that matched sub-expression n[.](#tab:re.alg.search-row-13-column-2-sentence-1)<br>Alternatively, if sub-expression n did not participate in the match, then last[.](#tab:re.alg.search-row-13-column-2-sentence-2) |
|
||
| [ð](#tab:re.alg.search-row-14)<br>m[n].second | For all integers 0 < n < m.size(), the end of the sequence that matched sub-expression n[.](#tab:re.alg.search-row-14-column-2-sentence-1)<br>Alternatively, if sub-expression n did not participate in the match, then last[.](#tab:re.alg.search-row-14-column-2-sentence-2) |
|
||
| [ð](#tab:re.alg.search-row-15)<br>m[n].matched | For all integers 0 < n < m.size(), true if sub-expression n participated in the match, false otherwise[.](#tab:re.alg.search-row-15-column-2-sentence-1) |
|
||
|
||
[ð](#lib:regex_search_)
|
||
|
||
`template<class charT, class Allocator, class traits>
|
||
bool regex_search(const charT* str, match_results<const charT*, Allocator>& m,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[4](#alg.search-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12022)
|
||
|
||
*Returns*: regex_search(str, str + char_traits<charT>::length(str), m, e, flags)[.](#alg.search-4.sentence-1)
|
||
|
||
[ð](#lib:regex_search__)
|
||
|
||
`template<class ST, class SA, class Allocator, class charT, class traits>
|
||
bool regex_search(const basic_string<charT, ST, SA>& s,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>& m,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[5](#alg.search-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12038)
|
||
|
||
*Returns*: regex_search(s.begin(), s.end(), m, e, flags)[.](#alg.search-5.sentence-1)
|
||
|
||
[ð](#lib:regex_search___)
|
||
|
||
`template<class BidirectionalIterator, class charT, class traits>
|
||
bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[6](#alg.search-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12052)
|
||
|
||
*Effects*: Behaves âas ifâ by constructing an object what of type match_results<BidirectionalIterator> and returningregex_search(first, last, what, e, flags)[.](#alg.search-6.sentence-1)
|
||
|
||
[ð](#lib:regex_search____)
|
||
|
||
`template<class charT, class traits>
|
||
bool regex_search(const charT* str,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[7](#alg.search-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12068)
|
||
|
||
*Returns*: regex_search(str, str + char_traits<charT>::length(str), e, flags)[.](#alg.search-7.sentence-1)
|
||
|
||
[ð](#lib:regex_search_____)
|
||
|
||
`template<class ST, class SA, class charT, class traits>
|
||
bool regex_search(const basic_string<charT, ST, SA>& s,
|
||
const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[8](#alg.search-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12082)
|
||
|
||
*Returns*: regex_search(s.begin(), s.end(), e, flags)[.](#alg.search-8.sentence-1)
|
||
|
||
#### [28.6.10.4](#alg.replace) regex_replace [[re.alg.replace]](re.alg.replace)
|
||
|
||
[ð](#lib:regex_replace)
|
||
|
||
`template<class OutputIterator, class BidirectionalIterator,
|
||
class traits, class charT, class ST, class SA>
|
||
OutputIterator
|
||
regex_replace(OutputIterator out,
|
||
BidirectionalIterator first, BidirectionalIterator last,
|
||
const basic_regex<charT, traits>& e,
|
||
const basic_string<charT, ST, SA>& fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
template<class OutputIterator, class BidirectionalIterator, class traits, class charT>
|
||
OutputIterator
|
||
regex_replace(OutputIterator out,
|
||
BidirectionalIterator first, BidirectionalIterator last,
|
||
const basic_regex<charT, traits>& e,
|
||
const charT* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[1](#alg.replace-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12109)
|
||
|
||
*Effects*: Constructs a regex_iterator object i as if byregex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags) and uses i to enumerate through all
|
||
of the matches m of type match_results<BidirectionalIterator> that occur within the sequence [first, last)[.](#alg.replace-1.sentence-1)
|
||
|
||
If no such
|
||
matches are found and!(flags & regex_constants::format_no_copy), then callsout = copy(first, last, out)
|
||
|
||
If any matches are found then, for each such match:
|
||
|
||
- [(1.1)](#alg.replace-1.1)
|
||
|
||
If !(flags & regex_constants::format_no_copy), callsout = copy(m.prefix().first, m.prefix().second, out)
|
||
|
||
- [(1.2)](#alg.replace-1.2)
|
||
|
||
Then callsout = m.format(out, fmt, flags) for the first form of the function andout = m.format(out, fmt, fmt + char_traits<charT>::length(fmt), flags) for the second.
|
||
|
||
Finally, if such a match
|
||
is found and !(flags & regex_constants::format_no_copy),
|
||
callsout = copy(last_m.suffix().first, last_m.suffix().second, out) where last_m is a copy of the last match
|
||
found[.](#alg.replace-1.sentence-3)
|
||
|
||
If flags & regex_constants::format_first_only is nonzero, then only the first match found is replaced[.](#alg.replace-1.sentence-4)
|
||
|
||
[2](#alg.replace-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12155)
|
||
|
||
*Returns*: out[.](#alg.replace-2.sentence-1)
|
||
|
||
[ð](#lib:regex_replace_)
|
||
|
||
`template<class traits, class charT, class ST, class SA, class FST, class FSA>
|
||
basic_string<charT, ST, SA>
|
||
regex_replace(const basic_string<charT, ST, SA>& s,
|
||
const basic_regex<charT, traits>& e,
|
||
const basic_string<charT, FST, FSA>& fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
template<class traits, class charT, class ST, class SA>
|
||
basic_string<charT, ST, SA>
|
||
regex_replace(const basic_string<charT, ST, SA>& s,
|
||
const basic_regex<charT, traits>& e,
|
||
const charT* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[3](#alg.replace-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12177)
|
||
|
||
*Effects*: Constructs an empty string result of
|
||
type basic_string<charT, ST, SA> and calls:regex_replace(back_inserter(result), s.begin(), s.end(), e, fmt, flags);
|
||
|
||
[4](#alg.replace-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12185)
|
||
|
||
*Returns*: result[.](#alg.replace-4.sentence-1)
|
||
|
||
[ð](#lib:regex_replace__)
|
||
|
||
`template<class traits, class charT, class ST, class SA>
|
||
basic_string<charT>
|
||
regex_replace(const charT* s,
|
||
const basic_regex<charT, traits>& e,
|
||
const basic_string<charT, ST, SA>& fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
template<class traits, class charT>
|
||
basic_string<charT>
|
||
regex_replace(const charT* s,
|
||
const basic_regex<charT, traits>& e,
|
||
const charT* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default);
|
||
`
|
||
|
||
[5](#alg.replace-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12207)
|
||
|
||
*Effects*: Constructs an empty string result of
|
||
type basic_string<charT> and calls:regex_replace(back_inserter(result), s, s + char_traits<charT>::length(s), e, fmt, flags);
|
||
|
||
[6](#alg.replace-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12215)
|
||
|
||
*Returns*: result[.](#alg.replace-6.sentence-1)
|
||
|
||
### [28.6.11](#iter) Regular expression iterators [[re.iter]](re.iter)
|
||
|
||
#### [28.6.11.1](#regiter) Class template regex_iterator [[re.regiter]](re.regiter)
|
||
|
||
#### [28.6.11.1.1](#regiter.general) General [[re.regiter.general]](re.regiter.general)
|
||
|
||
[1](#regiter.general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12225)
|
||
|
||
The class template regex_iterator is an iterator adaptor[.](#regiter.general-1.sentence-1)
|
||
|
||
It represents a new view of an existing iterator sequence, by
|
||
enumerating all the occurrences of a regular expression within that
|
||
sequence[.](#regiter.general-1.sentence-2)
|
||
|
||
A regex_iterator uses regex_search to find successive
|
||
regular expression matches within the sequence from which it was
|
||
constructed[.](#regiter.general-1.sentence-3)
|
||
|
||
After the iterator is constructed, and every time operator++ is
|
||
used, the iterator finds and stores a value ofmatch_results<BidirectionalIterator>[.](#regiter.general-1.sentence-4)
|
||
|
||
If the end of the sequence is
|
||
reached (regex_search returns false), the iterator becomes equal to
|
||
the end-of-sequence iterator value[.](#regiter.general-1.sentence-5)
|
||
|
||
The default constructor
|
||
constructs an end-of-sequence iterator object,
|
||
which is the only legitimate iterator to be used for the end
|
||
condition[.](#regiter.general-1.sentence-6)
|
||
|
||
The result of operator* on an end-of-sequence iterator is not
|
||
defined[.](#regiter.general-1.sentence-7)
|
||
|
||
For any other iterator value aconst match_results<BidirectionalIterator>& is returned[.](#regiter.general-1.sentence-8)
|
||
|
||
The result ofoperator-> on an end-of-sequence iterator is not defined[.](#regiter.general-1.sentence-9)
|
||
|
||
For any other
|
||
iterator value a const match_results<BidirectionalIterator>* is
|
||
returned[.](#regiter.general-1.sentence-10)
|
||
|
||
It is impossible to store things into regex_iterators[.](#regiter.general-1.sentence-11)
|
||
|
||
Two
|
||
end-of-sequence iterators are always equal[.](#regiter.general-1.sentence-12)
|
||
|
||
An end-of-sequence
|
||
iterator is not equal to a non-end-of-sequence iterator[.](#regiter.general-1.sentence-13)
|
||
|
||
Two
|
||
non-end-of-sequence iterators are equal when they are constructed from
|
||
the same arguments[.](#regiter.general-1.sentence-14)
|
||
|
||
namespace std {template<class BidirectionalIterator, class charT = typename iterator_traits<BidirectionalIterator>::value_type, class traits = regex_traits<charT>>class regex_iterator {public:using regex_type = basic_regex<charT, traits>; using iterator_category = forward_iterator_tag; using iterator_concept = input_iterator_tag; using value_type = match_results<BidirectionalIterator>; using difference_type = ptrdiff_t; using pointer = const value_type*; using reference = const value_type&;
|
||
|
||
regex_iterator();
|
||
regex_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
regex_iterator(BidirectionalIterator, BidirectionalIterator, const regex_type&&,
|
||
regex_constants::match_flag_type = regex_constants::match_default) = delete;
|
||
regex_iterator(const regex_iterator&);
|
||
regex_iterator& operator=(const regex_iterator&); bool operator==(const regex_iterator&) const; bool operator==(default_sentinel_t) const { return *this == regex_iterator(); }const value_type& operator*() const; const value_type* operator->() const;
|
||
regex_iterator& operator++();
|
||
regex_iterator operator++(int); private: BidirectionalIterator begin; // *exposition only* BidirectionalIterator end; // *exposition only*const regex_type* pregex; // *exposition only* regex_constants::match_flag_type flags; // *exposition only* match_results<BidirectionalIterator> match; // *exposition only*};}
|
||
|
||
[2](#regiter.general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12292)
|
||
|
||
An object of type regex_iterator that is not an end-of-sequence iterator
|
||
holds a *zero-length match* if match[0].matched == true andmatch[0].first == match[0].second[.](#regiter.general-2.sentence-1)
|
||
|
||
[*Note [1](#regiter.general-note-1)*:
|
||
|
||
For
|
||
example, this can occur when the part of the regular expression that
|
||
matched consists only of an assertion (such as `'^'`, `'$'`,'\b', '\B')[.](#regiter.general-2.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
#### [28.6.11.1.2](#regiter.cnstr) Constructors [[re.regiter.cnstr]](re.regiter.cnstr)
|
||
|
||
[ð](#lib:regex_iterator,constructor)
|
||
|
||
`regex_iterator();
|
||
`
|
||
|
||
[1](#regiter.cnstr-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12311)
|
||
|
||
*Effects*: Constructs an end-of-sequence iterator[.](#regiter.cnstr-1.sentence-1)
|
||
|
||
[ð](#lib:regex_iterator,constructor_)
|
||
|
||
`regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
`
|
||
|
||
[2](#regiter.cnstr-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12324)
|
||
|
||
*Effects*: Initializes begin and end toa and b, respectively, setspregex to addressof(re), sets flags tom, then calls regex_search(begin, end, match, *pregex, flags)[.](#regiter.cnstr-2.sentence-1)
|
||
|
||
If this
|
||
call returns false the constructor sets *this to the end-of-sequence
|
||
iterator[.](#regiter.cnstr-2.sentence-2)
|
||
|
||
#### [28.6.11.1.3](#regiter.comp) Comparisons [[re.regiter.comp]](re.regiter.comp)
|
||
|
||
[ð](#lib:regex_iterator,operator==)
|
||
|
||
`bool operator==(const regex_iterator& right) const;
|
||
`
|
||
|
||
[1](#regiter.comp-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12342)
|
||
|
||
*Returns*: true if *this and right are both end-of-sequence
|
||
iterators or if the following conditions all hold:
|
||
|
||
- [(1.1)](#regiter.comp-1.1)
|
||
|
||
begin == right.begin,
|
||
|
||
- [(1.2)](#regiter.comp-1.2)
|
||
|
||
end == right.end,
|
||
|
||
- [(1.3)](#regiter.comp-1.3)
|
||
|
||
pregex == right.pregex,
|
||
|
||
- [(1.4)](#regiter.comp-1.4)
|
||
|
||
flags == right.flags, and
|
||
|
||
- [(1.5)](#regiter.comp-1.5)
|
||
|
||
match[0] == right.match[0];
|
||
|
||
otherwise false[.](#regiter.comp-1.sentence-1)
|
||
|
||
#### [28.6.11.1.4](#regiter.deref) Indirection [[re.regiter.deref]](re.regiter.deref)
|
||
|
||
[ð](#lib:regex_iterator,operator*)
|
||
|
||
`const value_type& operator*() const;
|
||
`
|
||
|
||
[1](#regiter.deref-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12364)
|
||
|
||
*Returns*: match[.](#regiter.deref-1.sentence-1)
|
||
|
||
[ð](#lib:operator-%3e,regex_iterator)
|
||
|
||
`const value_type* operator->() const;
|
||
`
|
||
|
||
[2](#regiter.deref-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12375)
|
||
|
||
*Returns*: addressof(match)[.](#regiter.deref-2.sentence-1)
|
||
|
||
#### [28.6.11.1.5](#regiter.incr) Increment [[re.regiter.incr]](re.regiter.incr)
|
||
|
||
[ð](#lib:regex_iterator,operator++)
|
||
|
||
`regex_iterator& operator++();
|
||
`
|
||
|
||
[1](#regiter.incr-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12389)
|
||
|
||
*Effects*: Constructs a local variable start of type BidirectionalIterator and
|
||
initializes it with the value of match[0].second[.](#regiter.incr-1.sentence-1)
|
||
|
||
[2](#regiter.incr-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12394)
|
||
|
||
If the iterator holds a zero-length match and start == end the operator
|
||
sets *this to the end-of-sequence iterator and returns *this[.](#regiter.incr-2.sentence-1)
|
||
|
||
[3](#regiter.incr-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12398)
|
||
|
||
Otherwise, if the iterator holds a zero-length match, the operator calls:regex_search(start, end, match, *pregex,
|
||
flags | regex_constants::match_not_null | regex_constants::match_continuous)
|
||
|
||
If the call returns true the operator
|
||
returns *this[.](#regiter.incr-3.sentence-2)
|
||
|
||
Otherwise the operator increments start and continues as if
|
||
the most recent match was not a zero-length match[.](#regiter.incr-3.sentence-3)
|
||
|
||
[4](#regiter.incr-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12410)
|
||
|
||
If the most recent match was not a zero-length match, the operator setsflags to flags | regex_constants::match_prev_avail and
|
||
calls regex_search(start, end, match, *pregex, flags)[.](#regiter.incr-4.sentence-1)
|
||
|
||
If the call returnsfalse the iterator sets *this to the end-of-sequence iterator[.](#regiter.incr-4.sentence-2)
|
||
|
||
The
|
||
iterator then returns *this[.](#regiter.incr-4.sentence-3)
|
||
|
||
[5](#regiter.incr-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12418)
|
||
|
||
In all cases in which the call to regex_search returns true,match.prefix().first shall be equal to the previous value ofmatch[0].second, and for each index i in the half-open range
|
||
[0, match.size()) for which match[i].matched is true,match.position(i) shall return distance(begin, match[i].first)[.](#regiter.incr-5.sentence-1)
|
||
|
||
[6](#regiter.incr-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12426)
|
||
|
||
[*Note [1](#regiter.incr-note-1)*:
|
||
|
||
This means that match.position(i) gives the
|
||
offset from the beginning of the target sequence, which is often not
|
||
the same as the offset from the sequence passed in the call
|
||
to regex_search[.](#regiter.incr-6.sentence-1)
|
||
|
||
â *end note*]
|
||
|
||
[7](#regiter.incr-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12434)
|
||
|
||
It is unspecified how the implementation makes these adjustments[.](#regiter.incr-7.sentence-1)
|
||
|
||
[8](#regiter.incr-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12437)
|
||
|
||
[*Note [2](#regiter.incr-note-2)*:
|
||
|
||
This means that an implementation can call an
|
||
implementation-specific search function, in which case a program-defined
|
||
specialization of regex_search will not be
|
||
called[.](#regiter.incr-8.sentence-1)
|
||
|
||
â *end note*]
|
||
|
||
[ð](#lib:regex_iterator,operator++_)
|
||
|
||
`regex_iterator operator++(int);
|
||
`
|
||
|
||
[9](#regiter.incr-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12452)
|
||
|
||
*Effects*: As if by:regex_iterator tmp = *this;++(*this);return tmp;
|
||
|
||
#### [28.6.11.2](#tokiter) Class template regex_token_iterator [[re.tokiter]](re.tokiter)
|
||
|
||
#### [28.6.11.2.1](#tokiter.general) General [[re.tokiter.general]](re.tokiter.general)
|
||
|
||
[1](#tokiter.general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12466)
|
||
|
||
The class template regex_token_iterator is an iterator adaptor; that
|
||
is to say it represents a new view of an existing iterator sequence,
|
||
by enumerating all the occurrences of a regular expression within that
|
||
sequence, and presenting one or more sub-expressions for each match
|
||
found[.](#tokiter.general-1.sentence-1)
|
||
|
||
Each position enumerated by the iterator is a sub_match class
|
||
template instance that represents what matched a particular sub-expression
|
||
within the regular expression[.](#tokiter.general-1.sentence-2)
|
||
|
||
[2](#tokiter.general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12476)
|
||
|
||
When class regex_token_iterator is used to enumerate a
|
||
single sub-expression with index â1 the iterator performs field
|
||
splitting: that is to say it enumerates one sub-expression for each section of
|
||
the character container sequence that does not match the regular
|
||
expression specified[.](#tokiter.general-2.sentence-1)
|
||
|
||
[3](#tokiter.general-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12483)
|
||
|
||
After it is constructed, the iterator finds and stores a valueregex_iterator<BidirectionalIterator> position and sets the internal count N to zero[.](#tokiter.general-3.sentence-1)
|
||
|
||
It also maintains a sequencesubs which contains a list of the sub-expressions which will be
|
||
enumerated[.](#tokiter.general-3.sentence-2)
|
||
|
||
Every time operator++ is used
|
||
the count N is incremented; if N exceeds or equals subs.size(),
|
||
then the iterator increments member position and sets count N to zero[.](#tokiter.general-3.sentence-3)
|
||
|
||
[4](#tokiter.general-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12494)
|
||
|
||
If the end of sequence is reached (position is equal to the end of
|
||
sequence iterator), the iterator becomes equal to the end-of-sequence
|
||
iterator value, unless the sub-expression being enumerated has index â1,
|
||
in which case the iterator enumerates one last sub-expression that contains
|
||
all the characters from the end of the last regular expression match to the
|
||
end of the input sequence being enumerated, provided that this would not be an
|
||
empty sub-expression[.](#tokiter.general-4.sentence-1)
|
||
|
||
[5](#tokiter.general-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12503)
|
||
|
||
The default constructor constructs
|
||
an end-of-sequence iterator object, which is the only legitimate
|
||
iterator to be used for the end condition[.](#tokiter.general-5.sentence-1)
|
||
|
||
The result of operator* on
|
||
an end-of-sequence iterator is not defined[.](#tokiter.general-5.sentence-2)
|
||
|
||
For any other iterator value aconst sub_match<BidirectionalIterator>& is returned[.](#tokiter.general-5.sentence-3)
|
||
|
||
The result of operator-> on an end-of-sequence iterator
|
||
is not defined[.](#tokiter.general-5.sentence-4)
|
||
|
||
For any other iterator value a const sub_match<BidirectionalIterator>* is returned[.](#tokiter.general-5.sentence-5)
|
||
|
||
[6](#tokiter.general-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12514)
|
||
|
||
It is impossible to store things
|
||
into regex_token_iterators[.](#tokiter.general-6.sentence-1)
|
||
|
||
Two end-of-sequence iterators are always
|
||
equal[.](#tokiter.general-6.sentence-2)
|
||
|
||
An end-of-sequence iterator is not equal to a
|
||
non-end-of-sequence iterator[.](#tokiter.general-6.sentence-3)
|
||
|
||
Two non-end-of-sequence iterators are
|
||
equal when they are constructed from the same arguments[.](#tokiter.general-6.sentence-4)
|
||
|
||
namespace std {template<class BidirectionalIterator, class charT = typename iterator_traits<BidirectionalIterator>::value_type, class traits = regex_traits<charT>>class regex_token_iterator {public:using regex_type = basic_regex<charT, traits>; using iterator_category = forward_iterator_tag; using iterator_concept = input_iterator_tag; using value_type = sub_match<BidirectionalIterator>; using difference_type = ptrdiff_t; using pointer = const value_type*; using reference = const value_type&;
|
||
|
||
regex_token_iterator();
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, int submatch = 0,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const vector<int>& submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||
initializer_list<int> submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default); template<size_t N> regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const int (&submatches)[N],
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type&& re, int submatch = 0,
|
||
regex_constants::match_flag_type m = regex_constants::match_default) = delete;
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type&& re, const vector<int>& submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default) = delete;
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type&& re,
|
||
initializer_list<int> submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default) = delete; template<size_t N> regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type&& re, const int (&submatches)[N],
|
||
regex_constants::match_flag_type m = regex_constants::match_default) = delete;
|
||
regex_token_iterator(const regex_token_iterator&);
|
||
regex_token_iterator& operator=(const regex_token_iterator&); bool operator==(const regex_token_iterator&) const; bool operator==(default_sentinel_t) const { return *this == regex_token_iterator(); }const value_type& operator*() const; const value_type* operator->() const;
|
||
regex_token_iterator& operator++();
|
||
regex_token_iterator operator++(int); private:using position_iterator = regex_iterator<BidirectionalIterator, charT, traits>; // *exposition only* position_iterator position; // *exposition only*const value_type* result; // *exposition only* value_type suffix; // *exposition only* size_t N; // *exposition only* vector<int> subs; // *exposition only*};}
|
||
|
||
[7](#tokiter.general-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12601)
|
||
|
||
A *suffix iterator* is a regex_token_iterator object
|
||
that points to a final sequence of characters at
|
||
the end of the target sequence[.](#tokiter.general-7.sentence-1)
|
||
|
||
In a suffix iterator the
|
||
member result holds a pointer to the data
|
||
member suffix, the value of the member suffix.match is true, suffix.first points to the beginning of the
|
||
final sequence, and suffix.second points to the end of the
|
||
final sequence[.](#tokiter.general-7.sentence-2)
|
||
|
||
[8](#tokiter.general-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12611)
|
||
|
||
[*Note [1](#tokiter.general-note-1)*:
|
||
|
||
For a suffix iterator, data
|
||
member suffix.first is the same as the end of the last match
|
||
found, and suffix.second is the same as the end of the target
|
||
sequence[.](#tokiter.general-8.sentence-1)
|
||
|
||
â *end note*]
|
||
|
||
[9](#tokiter.general-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12619)
|
||
|
||
The *current match* is (*position).prefix() if subs[N] == -1, or(*position)[subs[N]] for any other value of subs[N][.](#tokiter.general-9.sentence-1)
|
||
|
||
#### [28.6.11.2.2](#tokiter.cnstr) Constructors [[re.tokiter.cnstr]](re.tokiter.cnstr)
|
||
|
||
[ð](#lib:regex_token_iterator,constructor)
|
||
|
||
`regex_token_iterator();
|
||
`
|
||
|
||
[1](#tokiter.cnstr-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12631)
|
||
|
||
*Effects*: Constructs the end-of-sequence iterator[.](#tokiter.cnstr-1.sentence-1)
|
||
|
||
[ð](#lib:regex_token_iterator,constructor_)
|
||
|
||
`regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
int submatch = 0,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
const vector<int>& submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
initializer_list<int> submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
|
||
template<size_t N>
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
const int (&submatches)[N],
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
`
|
||
|
||
[2](#tokiter.cnstr-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12661)
|
||
|
||
*Preconditions*: Each of the initialization values of submatches is >= -1[.](#tokiter.cnstr-2.sentence-1)
|
||
|
||
[3](#tokiter.cnstr-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12665)
|
||
|
||
*Effects*: The first constructor initializes the member subs to hold the single
|
||
value submatch[.](#tokiter.cnstr-3.sentence-1)
|
||
|
||
The second, third, and fourth constructors
|
||
initialize the member subs to hold a copy of the sequence of integer values
|
||
pointed to by the iterator range
|
||
[begin(submatches), end(submatches))[.](#tokiter.cnstr-3.sentence-2)
|
||
|
||
[4](#tokiter.cnstr-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12674)
|
||
|
||
Each constructor then sets N to 0, and position toposition_iterator(a, b, re, m)[.](#tokiter.cnstr-4.sentence-1)
|
||
|
||
If position is not an
|
||
end-of-sequence iterator the constructor sets result to the
|
||
address of the current match[.](#tokiter.cnstr-4.sentence-2)
|
||
|
||
Otherwise if any of the values stored
|
||
in subs is equal to â1 the constructor sets *this to a suffix
|
||
iterator that points to the range [a, b), otherwise the constructor
|
||
sets *this to an end-of-sequence iterator[.](#tokiter.cnstr-4.sentence-3)
|
||
|
||
#### [28.6.11.2.3](#tokiter.comp) Comparisons [[re.tokiter.comp]](re.tokiter.comp)
|
||
|
||
[ð](#lib:regex_token_iterator,operator==_)
|
||
|
||
`bool operator==(const regex_token_iterator& right) const;
|
||
`
|
||
|
||
[1](#tokiter.comp-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12692)
|
||
|
||
*Returns*: true if *this and right are both end-of-sequence iterators,
|
||
or if *this and right are both suffix iterators and suffix == right.suffix;
|
||
otherwise returns false if *this or right is an end-of-sequence
|
||
iterator or a suffix iterator[.](#tokiter.comp-1.sentence-1)
|
||
|
||
Otherwise returns true if position == right.position,N == right.N, and subs == right.subs[.](#tokiter.comp-1.sentence-2)
|
||
|
||
Otherwise returns false[.](#tokiter.comp-1.sentence-3)
|
||
|
||
#### [28.6.11.2.4](#tokiter.deref) Indirection [[re.tokiter.deref]](re.tokiter.deref)
|
||
|
||
[ð](#lib:regex_token_iterator,operator*)
|
||
|
||
`const value_type& operator*() const;
|
||
`
|
||
|
||
[1](#tokiter.deref-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12709)
|
||
|
||
*Returns*: *result[.](#tokiter.deref-1.sentence-1)
|
||
|
||
[ð](#lib:operator-%3e,regex_token_iterator)
|
||
|
||
`const value_type* operator->() const;
|
||
`
|
||
|
||
[2](#tokiter.deref-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12720)
|
||
|
||
*Returns*: result[.](#tokiter.deref-2.sentence-1)
|
||
|
||
#### [28.6.11.2.5](#tokiter.incr) Increment [[re.tokiter.incr]](re.tokiter.incr)
|
||
|
||
[ð](#lib:regex_token_iterator,operator++)
|
||
|
||
`regex_token_iterator& operator++();
|
||
`
|
||
|
||
[1](#tokiter.incr-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12734)
|
||
|
||
*Effects*: Constructs a local variable prev of
|
||
type position_iterator, initialized with the value
|
||
of position[.](#tokiter.incr-1.sentence-1)
|
||
|
||
[2](#tokiter.incr-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12740)
|
||
|
||
If *this is a suffix iterator, sets *this to an
|
||
end-of-sequence iterator[.](#tokiter.incr-2.sentence-1)
|
||
|
||
[3](#tokiter.incr-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12744)
|
||
|
||
Otherwise, if N + 1 < subs.size(), increments N and
|
||
sets result to the address of the current match[.](#tokiter.incr-3.sentence-1)
|
||
|
||
[4](#tokiter.incr-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12748)
|
||
|
||
Otherwise, sets N to 0 and
|
||
increments position[.](#tokiter.incr-4.sentence-1)
|
||
|
||
If position is not an
|
||
end-of-sequence iterator the operator sets result to the
|
||
address of the current match[.](#tokiter.incr-4.sentence-2)
|
||
|
||
[5](#tokiter.incr-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12754)
|
||
|
||
Otherwise, if any of the values stored in subs is equal to â1 andprev->suffix().length() is not 0 the operator sets *this to a
|
||
suffix iterator that points to the range [prev->suffix().first, prev->suffix().second)[.](#tokiter.incr-5.sentence-1)
|
||
|
||
[6](#tokiter.incr-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12759)
|
||
|
||
Otherwise, sets *this to an end-of-sequence iterator[.](#tokiter.incr-6.sentence-1)
|
||
|
||
[7](#tokiter.incr-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12762)
|
||
|
||
*Returns*: *this[.](#tokiter.incr-7.sentence-1)
|
||
|
||
[ð](#lib:regex_token_iterator,operator++_)
|
||
|
||
`regex_token_iterator& operator++(int);
|
||
`
|
||
|
||
[8](#tokiter.incr-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12773)
|
||
|
||
*Effects*: Constructs a copy tmp of *this, then calls ++(*this)[.](#tokiter.incr-8.sentence-1)
|
||
|
||
[9](#tokiter.incr-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12777)
|
||
|
||
*Returns*: tmp[.](#tokiter.incr-9.sentence-1)
|
||
|
||
### [28.6.12](#grammar) Modified ECMAScript regular expression grammar [[re.grammar]](re.grammar)
|
||
|
||
[1](#grammar-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12786)
|
||
|
||
The regular expression grammar recognized bybasic_regex objects constructed with the ECMAScript
|
||
flag is that specified by ECMA-262, except as specified below[.](#grammar-1.sentence-1)
|
||
|
||
[2](#grammar-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12793)
|
||
|
||
Objects of type specialization of basic_regex store within themselves a
|
||
default-constructed instance of their traits template parameter, henceforth
|
||
referred to as traits_inst[.](#grammar-2.sentence-1)
|
||
|
||
This traits_inst object is used to support localization
|
||
of the regular expression; basic_regex member functions shall not call
|
||
any locale dependent C or C++ API, including the formatted string input functions[.](#grammar-2.sentence-2)
|
||
|
||
Instead they shall call the appropriate traits member function to achieve the required effect[.](#grammar-2.sentence-3)
|
||
|
||
[3](#grammar-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12803)
|
||
|
||
The following productions within the ECMAScript grammar are modified as follows:
|
||
|
||
ClassAtom ::
|
||
-
|
||
ClassAtomNoDash
|
||
ClassAtomExClass
|
||
ClassAtomCollatingElement
|
||
ClassAtomEquivalence
|
||
|
||
IdentityEscape ::
|
||
SourceCharacter **but not** c
|
||
|
||
[4](#grammar-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12820)
|
||
|
||
The following new productions are then added:
|
||
|
||
ClassAtomExClass ::
|
||
[: ClassName :]
|
||
|
||
ClassAtomCollatingElement ::
|
||
[. ClassName .]
|
||
|
||
ClassAtomEquivalence ::
|
||
[= ClassName =]
|
||
|
||
ClassName ::
|
||
ClassNameCharacter
|
||
ClassNameCharacter ClassName
|
||
|
||
ClassNameCharacter ::
|
||
SourceCharacter **but not one of** . **or** = **or** :
|
||
|
||
[5](#grammar-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12849)
|
||
|
||
The productions *ClassAtomExClass*, *ClassAtomCollatingElement* and *ClassAtomEquivalence* provide functionality
|
||
equivalent to that of the same features in regular expressions in POSIX[.](#grammar-5.sentence-1)
|
||
|
||
[6](#grammar-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12854)
|
||
|
||
The regular expression grammar may be modified by
|
||
any regex_constants::syntax_option_type flags specified when
|
||
constructing an object of type specialization of basic_regex according to the rules in Table [118](#tab:re.synopt "Table 118: syntax_option_type effects")[.](#grammar-6.sentence-1)
|
||
|
||
[7](#grammar-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12860)
|
||
|
||
A *ClassName* production, when used in *ClassAtomExClass*,
|
||
is not valid if traits_inst.lookup_classname returns zero for
|
||
that name[.](#grammar-7.sentence-1)
|
||
|
||
The names recognized as valid *ClassName**s* are
|
||
determined by the type of the traits class, but at least the following
|
||
names shall be recognized:alnum, alpha, blank, cntrl, digit,graph, lower, print, punct, space,upper, xdigit, d, s, w[.](#grammar-7.sentence-2)
|
||
|
||
In addition the following expressions shall be equivalent:
|
||
|
||
\d and [[:digit:]] \D and [^[:digit:]] \s and [[:space:]] \S and [^[:space:]] \w and [_[:alnum:]] \W and [^_[:alnum:]]
|
||
|
||
[8](#grammar-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12885)
|
||
|
||
A *ClassName* production when used in
|
||
a *ClassAtomCollatingElement* production is not valid
|
||
if the value returned by traits_inst.lookup_collatename for
|
||
that name is an empty string[.](#grammar-8.sentence-1)
|
||
|
||
[9](#grammar-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12893)
|
||
|
||
The results from multiple calls
|
||
to traits_inst.lookup_classname can be bitwise or'ed
|
||
together and subsequently passed to traits_inst.isctype[.](#grammar-9.sentence-1)
|
||
|
||
[10](#grammar-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12902)
|
||
|
||
A *ClassName* production when used in
|
||
a *ClassAtomEquivalence* production is not valid if the value
|
||
returned by traits_inst.lookup_collatename for that name is an
|
||
empty string or if the value returned by traits_inst.transform_primary for the result of the call to traits_inst.lookup_collatename is an empty string[.](#grammar-10.sentence-1)
|
||
|
||
[11](#grammar-11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12910)
|
||
|
||
When the sequence of characters being transformed to a finite state
|
||
machine contains an invalid class name the translator shall throw an
|
||
exception object of type regex_error[.](#grammar-11.sentence-1)
|
||
|
||
[12](#grammar-12)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12916)
|
||
|
||
If the *CV* of a *UnicodeEscapeSequence* is greater than the largest
|
||
value that can be held in an object of type charT the translator shall
|
||
throw an exception object of type regex_error[.](#grammar-12.sentence-1)
|
||
|
||
[*Note [1](#grammar-note-1)*:
|
||
|
||
This means that values of the form "\uxxxx" that do not fit in
|
||
a character are invalid[.](#grammar-12.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
[13](#grammar-13)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12926)
|
||
|
||
Where the regular expression grammar requires the conversion of a sequence of characters
|
||
to an integral value, this is accomplished by calling traits_inst.value[.](#grammar-13.sentence-1)
|
||
|
||
[14](#grammar-14)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12930)
|
||
|
||
The behavior of the internal finite state machine representation when used to match a
|
||
sequence of characters is as described in ECMA-262[.](#grammar-14.sentence-1)
|
||
|
||
The behavior is modified according
|
||
to any match_flag_type flags ([[re.matchflag]](#matchflag "28.6.4.3 Bitmask type match_flag_type")) specified when using the regular expression
|
||
object in one of the regular expression algorithms ([[re.alg]](#alg "28.6.10 Regular expression algorithms"))[.](#grammar-14.sentence-2)
|
||
|
||
The behavior is also
|
||
localized by interaction with the traits class template parameter as follows:
|
||
|
||
- [(14.1)](#grammar-14.1)
|
||
|
||
During matching of a regular expression finite state machine
|
||
against a sequence of characters, two characters c and d are compared using the following rules:
|
||
* [(14.1.1)](#grammar-14.1.1)
|
||
|
||
if (flags() & regex_constants::icase) the two characters are equal
|
||
if traits_inst.translate_nocase(c) == traits_inst.translate_nocase(d);
|
||
|
||
* [(14.1.2)](#grammar-14.1.2)
|
||
|
||
otherwise, if flags() & regex_constants::collate the
|
||
two characters are equal iftraits_inst.translate(c) == traits_inst.translate(d);
|
||
|
||
* [(14.1.3)](#grammar-14.1.3)
|
||
|
||
otherwise, the two characters are equal if c == d[.](#grammar-14.1.sentence-1)
|
||
|
||
- [(14.2)](#grammar-14.2)
|
||
|
||
During matching of a regular expression finite state machine
|
||
against a sequence of characters, comparison of a collating element
|
||
range c1-c2 against a character c is
|
||
conducted as follows: if flags() & regex_constants::collate is false then the character c is matched if c1<= c && c <= c2, otherwise c is matched in
|
||
accordance with the following algorithm:
|
||
string_type str1 = string_type(1,
|
||
flags() & icase ? traits_inst.translate_nocase(c1) : traits_inst.translate(c1));
|
||
string_type str2 = string_type(1,
|
||
flags() & icase ? traits_inst.translate_nocase(c2) : traits_inst.translate(c2));
|
||
string_type str = string_type(1,
|
||
flags() & icase ? traits_inst.translate_nocase(c) : traits_inst.translate(c));return traits_inst.transform(str1.begin(), str1.end())<= traits_inst.transform(str.begin(), str.end())&& traits_inst.transform(str.begin(), str.end())<= traits_inst.transform(str2.begin(), str2.end());
|
||
|
||
- [(14.3)](#grammar-14.3)
|
||
|
||
During matching of a regular expression finite state machine against a sequence of
|
||
characters, testing whether a collating element is a member of a primary equivalence
|
||
class is conducted by first converting the collating element and the equivalence
|
||
class to sort keys using traits::transform_primary, and then comparing the sort
|
||
keys for equality[.](#grammar-14.3.sentence-1)
|
||
|
||
- [(14.4)](#grammar-14.4)
|
||
|
||
During matching of a regular expression finite state machine against a sequence
|
||
of characters, a character c is a member of a character class designated by an
|
||
iterator range [first, last) iftraits_inst.isctype(c, traits_inst.lookup_classname(first, last, flags() & icase)) is true[.](#grammar-14.4.sentence-1)
|
||
|
||
See also: ECMA-262 15.10
|