31 Regular expressions library [re]

31.8 Class template basic_­regex [re.regex]

31.8.2 basic_­regex constructors [re.regex.construct]

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).