30 Regular expressions library [re]

30.8 Class template basic_­regex [re.regex]

30.8.1 Constructors [re.regex.construct]

basic_regex();
Postconditions: *this does not match any character sequence.
explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
Preconditions: [p, p + char_­traits<charT>​::​length(p)) is a valid range.
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.
Postconditions: flags() returns f.
mark_­count() returns the number of marked sub-expressions within the expression.
Throws: regex_­error if [p, p + char_­traits<charT>​::​length(p)) is not a valid regular expression.
basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
Preconditions: [p, p + len) is a valid range.
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.
Postconditions: flags() returns f.
mark_­count() returns the number of marked sub-expressions within the expression.
Throws: regex_­error if [p, p + len) is not a valid regular expression.
basic_regex(const basic_regex& e);
Postconditions: flags() and mark_­count() return e.flags() and e.mark_­count(), respectively.
basic_regex(basic_regex&& e) noexcept;
Postconditions: flags() and mark_­count() return the values that e.flags() and e.mark_­count(), respectively, had before construction.
template<class ST, class SA> explicit basic_regex(const basic_string<charT, ST, SA>& s, flag_type f = regex_constants::ECMAScript);
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.
Postconditions: flags() returns f.
mark_­count() returns the number of marked sub-expressions within the expression.
Throws: regex_­error if s is not a valid regular expression.
template<class ForwardIterator> basic_regex(ForwardIterator first, ForwardIterator last, flag_type f = regex_constants::ECMAScript);
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.
Postconditions: flags() returns f.
mark_­count() returns the number of marked sub-expressions within the expression.
Throws: regex_­error if the sequence [first, last) is not a valid regular expression.
basic_regex(initializer_list<charT> il, flag_type f = regex_constants::ECMAScript);
Effects: Same as basic_­regex(il.begin(), il.end(), f).