Definitions






Definitions

A bitmask type is defined by the library implementation. Values of a bitmask type can be combined with the | operator to create new values that represent the union of the values specified by the operands and with the & operator to create new values that represent the intersection of the values specified by the operands.

An enumeration type is defined by the library implementation. It provides a set of named constants.

An empty regular expression does not match any character sequence.

The constructors, the assignment operators, and the assign member functions for objects of type basic_regex<Elem> all take an operand sequence that designates the regular expression that the resulting object will hold. The constructors and the assign member functions also take an additional argument that designates the regular expression grammar to use to interpret the operand sequence, as well as some optional flags to permit optimizations and to modify the meaning of some elements of the regular expression grammar. These functions all throw an object of type regex_error (see Section 16.6) if the operand sequence is not a valid regular expression.

In the descriptions of these functions, the names of the arguments are used to describe the form of the operand sequence:

  • ptr: a null-terminated sequence of characters of type Elemsuch as a C string, when Elem is type charbeginning at ptr, which must not be a null pointer, where the terminating element is the value Elem() and is not part of the operand sequence

  • ptr, count: a sequence of count characters of type Elem beginning at ptr, which must not be a null pointer

  • str: the sequence specified by the basic_string<Elem> object str

  • first, last: a sequence of characters of type Elem delimited by the iterators first and last, in the range [first, last)

  • right: the basic_regex<Elem> object right

For example, the constructor

explicit basic_regex( const Elem *ptr,
  flag_type flags = ECMAScript)

constructs a basic_regex<Elem> object from a null-terminated character sequence:

basic_regex<char> rgx("a*b"); // rgx holds regular expression "a*b"

The constructor

basic_regex(const Elem *ptr, size_type count,
  flag_type flags = ECMAScript)

constructs a basic_regex<Elem> object from a C-style array and a character count:

basic_regex<char> rgx("a*b", 2);
                               // rgx holds regular expression "a*"

The constructor

template<class STraits, class STalloc>
explicit basic_regex(
  const basic_string<Elem, STraits, STalloc>& str,
  flag_type flags = ECMAScript)

constructs a basic_regex<Elem> object from a C++ basic_string<Elem> object:

string str("a*b");
basic_regex<char> rgx(str);   // rgx holds regular expression "a*b"

The constructor

template<class InIt>
basic_regex(InIt first, InIt last,
  flag_type flags = ECMAScript)

constructs a basic_regex<Elem> object from a pair of iterators:

vector<char> vec;
vec.push_back('a');
vec.push_back('*');
vec.push_back('b');
basic_regex<char> rgx(vec.begin(), vec.end());
                              // rgx holds regular expression "a*b"

And the constructor

basic_regex(const basic_regex <Elem>& right)

constructs a basic_regex<Elem> object from another basic_regex<Elem> object:

basic_regex<char> rgx("a*b"); // rgx holds regular expression "a*b"
basic_regex<char> rgy("a*b"); // rgy holds regular expression "a*b"



 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows