Namespaces
Variants
Views
Actions

std::basic_regex::basic_regex

From cppreference.com
< cpp‎ | regex‎ | basic regex
Revision as of 15:46, 14 January 2013 by Nate (Talk | contribs)

Template:ddcl list begin <tr class="t-dcl ">

<td >
basic_regex();
</td>

<td > (1) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
explicit basic_regex( const CharT* s,
                      flag_type f = std::regex_constants::ECMAScript );
</td>

<td > (2) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
basic_regex( const CharT* s, std::size_t count,
             flag_type f = std::regex_constants::ECMAScript );
</td>

<td > (3) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
basic_regex( const basic_regex& other );
</td>

<td > (4) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
basic_regex( basic_regex&& other );
</td>

<td > (5) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class ST, class SA >

explicit basic_regex( const std::basic_string<CharT,ST,SA>& str,

                      flag_type f = std::regex_constants::ECMAScript );
</td>

<td > (6) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class ForwardIt >

basic_regex( ForwardIt first, ForwardIt last,

             flag_type f = std::regex_constants::ECMAScript );
</td>

<td > (7) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
basic_regex( std::initializer_list<CharT> init,
             flag_type f = std::regex_constants::ECMAScript );
</td>

<td > (8) </td> <td > (since C++11) </td> </tr> Template:ddcl list end

Constructs a new regular expression from a sequence of characters interpreted according to the flags f.

1) Default constructor. Constructs an empty regular expression which will match nothing.
2) Constructs a regex from a null-terminated string s.
3) Constructs a regex from a sequence of count characters, pointed to by s.
4) Copy constructor. Constructs a regex by copying other
5) Move constructor. Constructs a regex by with the contents of other using move semantics.
6) Constructs a regex from a string str.
7) Range constructor. Constructs the string with the contents of the range [first, last).
8) Initializer list constructor. Constructs the string with the contents of the initializer list init.

Parameters

s - pointer to a null-terminated string
count - length of a character sequence used to initialize the regex
first, last - range of a character sequence used to initialize the regex
str - a basic_string used as a source used to initialize the regex
other - another regex to use as source to initialize the regex
init - initializer list used to initialize the regex
f - flags used to guide the interpretation of the character sequence as a regular expression
Type requirements
-
ForwardIt must meet the requirements of ForwardIterator.

Exceptions

1) (none)
2-3) std::regex_error if the supplied regular expression is not valid.
4)
noexcept specification:  
noexcept
  
5-8) std::regex_error if the supplied regular expression is not valid.