31 Regular expressions library [re]
31.8 Class template basic_regex [re.regex]
basic_regex();
Effects: Constructs an object of class
basic_regex that
does not match any character sequence
. explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
Requires: p shall not be a null pointer
. Throws: regex_error if
p is not a valid regular expression
. Effects: Constructs an object of class
basic_regex; the object's
internal finite state machine is constructed from the regular
expression contained in the array of
charT of length
char_traits<charT>::length(p) whose first element is
designated by
p, and interpreted according to the flags
f. Postconditions:
flags() returns
f. mark_count() returns the number of marked sub-expressions
within the expression
. basic_regex(const charT* p, size_t len, flag_type f);
Requires: p shall not be a null pointer
. Throws: regex_error if
p is not a valid regular expression
. Effects: Constructs an object of class
basic_regex; 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. Postconditions:
flags() returns
f. mark_count() returns the number of marked sub-expressions
within the expression
. basic_regex(const basic_regex& e);
Effects: Constructs an object of class
basic_regex as a copy of
the object
e. Postconditions:
flags() and
mark_count() return
e.flags() and
e.mark_count(), respectively
. basic_regex(basic_regex&& e) noexcept;
Effects: Move constructs an object of class
basic_regex from
e. Postconditions: flags() and
mark_count() return the values that
e.flags() and
e.mark_count(), respectively, had before construction
. e is in a valid state with unspecified value
. template <class ST, class SA>
explicit basic_regex(const basic_string<charT, ST, SA>& s,
flag_type f = regex_constants::ECMAScript);
Throws: regex_error if
s is not a valid regular expression
. Effects: Constructs an object of class
basic_regex; 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. Postconditions:
flags() returns
f. mark_count() returns the number of marked sub-expressions
within the expression
. template <class ForwardIterator>
basic_regex(ForwardIterator first, ForwardIterator last,
flag_type f = regex_constants::ECMAScript);
Throws: regex_error if the sequence
[first, last) is not a
valid regular expression
. Effects: Constructs an object of class
basic_regex; 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. Postconditions:
flags() returns
f. mark_count() returns the number of marked sub-expressions
within the expression
. basic_regex(initializer_list<charT> il, flag_type f = regex_constants::ECMAScript);
Effects: Same as
basic_regex(il.begin(), il.end(), f).