Include the TR1 header <regex> to define a template class to parse regular expressions and several template classes and functions to search text for matches to a regular expression object.
To create a regular expression object use the template class basic_regex or one of its specializations, regex and wregex, along with the syntax flags of type syntax_option_type.
To search text for matches to a regular expression object use the template functions regex_match and regex_search, along with the match flags of type match_flag_type. These functions return their results using the template class match_results and its specializations, cmatch, wcmatch, smatch, and wsmatch, along with the template class sub_match and its specializations, csub_match, wcsub_match, ssub_match, and wssub_match.
To replace text that matches a regular expression object use the template function regex_replace, along with the match flags of type match_flag_type.
To iterate through multiple matches of a regular expression object use the template classes regex_iterator and regex_token_iterator or one of their specializations, cregex_iterator, sregex_iterator, wcregex_iterator, wsregex_iterator, cregex_token_iterator, sregex_token_iterator, wcregex_token_iterator, and wsregex_token_iterator, along with the match flags of type match_flag_type.
To modify some of the details of the grammar of regular expressions write a class that implements the regular expression traits.
namespace std {
namespace tr1 {
// TEMPLATE CLASS regex_traits AND basic_regex
template<class Elem>
struct regex_traits;
template<>
struct regex_traits<char>;
template<>
struct regex_traits<wchar_t>;
template<class Elem,
class RXtraits = regex_traits<Elem>,
class basic_regex;
typedef basic_regex<char> regex;
typedef basic_regex<wchar_t> wregex;
// TEMPLATE CLASS sub_match
template<class BidIt>
class sub_match;
typedef sub_match<const char*> csub_match;
typedef sub_match<const wchar_t*> wcsub_match;
typedef sub_match<string::const_iterator> ssub_match;
typedef sub_match<wstring::const_iterator> wssub_match;
// TEMPLATE CLASS match_results
template<class BidIt,
class Alloc = allocator<typename iterator_traits<BidIt>::value_type> >
class match_results;
typedef match_results<const char*> cmatch;
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<string::const_iterator> smatch;
typedef match_results<wstring::const_iterator> wsmatch;
// NAMESPACE regex_constants
namespace regex_constants {
typedef T1 syntax_option_type;
static const syntax_option_type awk, basic, collate, ECMAScript,
egrep, extended, grep, icase, nosubs, optimize;
typedef T2 match_flag_type;
static const match_flag_type match_any, match_default, match_not_bol,
match_not_bow, match_continuous, match_not_eol, match_not_eow,
match_not_null, match_partial, match_prev_avail;
typedef T3 error_type;
static const error_type error_badbrace, error_badrepeat, error_brace,
error_brack, error_collate, error_complexity, error_ctype,
error_escape, error_paren, error_range, error_space,
error_stack, error_backref;
} // namespace regex_constants
// CLASS regex_error
class regex_error;
// TEMPLATE FUNCTION regex_match
template<class BidIt, class Alloc, class Elem, class RXtraits>
bool regex_match(BidIt first, Bidit last,
match_results<BidIt, Alloc>& match,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class BidIt, class Elem, class RXtraits>
bool regex_match(BidIt first, Bidit last,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class Elem, class Alloc, class RXtraits>
bool regex_match(const Elem* ptr,
match_results<const Elem*, Alloc>& match,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class Elem, class RXtraits>
bool regex_match(const Elem* ptr,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class IOtraits, class IOalloc, class Alloc, class Elem, class RXtraits>
bool regex_match(
const basic_string<Elem, IOtraits, IOalloc>& str,
match_results<typename basic_string<Elem, IOtraits, IOalloc>::
const_iterator, Alloc>& match,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags= match_default);
template<class IOtraits, class IOalloc, class Elem, class RXtraits>
bool regex_match(
const basic_string<Elem, IOtraits, IOalloc>& match,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
// TEMPLATE FUNCTION regex_search
template<class BidIt, class Alloc, class Elem, class RXtraits>
bool regex_search(BidIt first, Bidit last,
match_results<BidIt, Alloc>& match,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class BidIt, class Elem, class RXtraits>
bool regex_search(BidIt first, Bidit last,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class Elem, class Alloc, class RXtraits>
bool regex_search(const Elem* ptr,
match_results<const Elem*, Alloc>& match,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class Elem, class RXtraits>
bool regex_search(const Elem* ptr,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class IOtraits, class IOalloc, class Alloc, class Elem, class RXtraits>
bool regex_search(
const basic_string<Elem, IOtraits, IOalloc>& str,
match_results<typename basic_string<Elem, IOtraits, IOalloc>::
const_iterator, Alloc>& match,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class IOtraits, class IOalloc, class Elem, class RXtraits>
bool regex_search(
const basic_string<Elem, IOtraits, IOalloc>& str,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
// TEMPLATE FUNCTION regex_replace
template<class OutIt, class BidIt, class RXtraits, class Elem>
OutIt regex_replace(OutIt out, BidIt first, BidIt last,
const basic_regex<Elem, RXtraits>& re,
const basic_string<Elem>& fmt,
match_flag_type flags = match_default);
template<class RXtraits, class Elem>
basic_string<Elem> regex_replace(
const basic_string<Elem>& str,
const basic_regex<Elem, RXtraits>& re,
const basic_string<Elem>& fmt,
match_flag_type flags = match_default);
// REGULAR EXPRESSION ITERATORS
template<class BidIt, class Elem = iterator_traits<BidIt>::value_type,
class RXtraits = regex_traits<Elem> >
class regex_iterator;
typedef regex_iterator<const char*> cregex_iterator;
typedef regex_iterator<const wchar_t*> wcregex_iterator;
typedef regex_iterator<string::const_iterator> sregex_iterator;
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
template<class BidIt, class Elem = iterator_traits<BidIt>::value_type,
class RXtraits = regex_traits<Elem> >
class regex_token_iterator;
typedef regex_token_iterator<const char*> cregex_token_iterator;
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
// STREAM INSERTER
template<class Elem, class IOtraits, class Alloc, class BidIt>
basic_ostream<Elem, IOtraits>&
operator<<(
basic_ostream<Elem, IOtraits>& os,
const sub_match<BidIt>& submatch);
// TEMPLATE swap FUNCTIONS
template<class Elem, class RXtraits>
void swap(
basic_regex<Elem, RXtraits>& left,
basic_regex<Elem, RXtraits>& right) throw();
template<class Elem, class IOtraits, class BidIt, class Alloc>
void swap(
match_results<BidIt, Alloc>& left,
match_results<BidIt, Alloc>& right) throw();
// COMPARISON OPERATORS FOR match_results
template<class BidIt, class Alloc>
bool operator==(
const match_results<BidIt, Alloc>& left,
const match_results<BidIt, Alloc>& right);
template<class BidIt, class Alloc>
bool operator!=(
const match_results<BidIt, Alloc>& left,
const match_results<BidIt, Alloc>& right);
// COMPARISON OPERATORS FOR sub_match
template<class BidIt>
bool operator==(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator!=(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<=(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>=(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator==(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left, const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator!=(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left, const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator<(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left, const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator<=(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left, const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator>(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left, const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator>=(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left, const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator==(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator!=(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator<(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator<=(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator>(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator>=(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt>
bool operator==(
const typename iterator_traits<BidIt>::value_type* left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator!=(
const typename iterator_traits<BidIt>::value_type* left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<(
const typename iterator_traits<BidIt>::value_type* left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<=(
const typename iterator_traits<BidIt>::value_type* left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>(
const typename iterator_traits<BidIt>::value_type* left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>=(
const typename iterator_traits<BidIt>::value_type* left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator==(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type*);
template<class BidIt>
bool operator!=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type*);
template<class BidIt>
bool operator<(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type*);
template<class BidIt>
bool operator<=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type*);
template<class BidIt>
bool operator>(
const sub_match<BidIt>&, left
const typename iterator_traits<BidIt>::value_type*);
template<class BidIt>
bool operator>=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type*);
template<class BidIt>
bool operator==(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator!=(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<=(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>=(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator==(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
template<class BidIt>
bool operator!=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
template<class BidIt>
bool operator<(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
template<class BidIt>
bool operator<=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
template<class BidIt>
bool operator>(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
template<class BidIt>
bool operator>=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
} // namespace tr1
} // namespace std
The template class describes an object that holds a regular expression. Objects of this template class can be passed to the template functions regex_match, regex_search, and regex_replace, along with suitable text string arguments, to search for text that matches the regular expression. The TR1 library provides two specializations of this template class, with the type definitions regex for elements of type char, and wregex for elements of type wchar_t.
The template argument RXtraits describes various important properties of the syntax of the regular expressions that the template class supports. A class that specifies these regular expression traits must have the same external interface as an object of template class regex_traits.
Some functions take an operand sequence that defines a regular expression. You can specify such an operand sequence several ways:
These member functions also take an argument flags that specifies various options for the interpretation of the regular expression in addition to those described by the RXtraits type.
template<class Elem,
class RXtraits = regex_traits<Elem>,
class basic_regex {
public:
basic_regex();
explicit basic_regex(const Elem *ptr,
flag_type flags = ECMAScript);
basic_regex(const Elem *ptr, size_type len,
flag_type flags = ECMAScript);
basic_regex(const basic_regex& right);
template<class STtraits, class STalloc>
explicit basic_regex(const basic_string<Elem, STtraits, STalloc>& str,
flag_type flags = ECMAScript);
template<class InIt>
explicit basic_regex(InIt first, InIt last,
flag_type flags = ECMAScript);
basic_regex& operator=(const basic_regex& right);
basic_regex& operator=(const Elem *ptr);
template<class STtraits, class STalloc>
basic_regex& operator=(const basic_string<Elem, STtraits, STalloc>& str);
basic_regex& assign(const basic_regex& right);
basic_regex& assign(const Elem *ptr,
flag_type flags = ECMAScript);
basic_regex& assign(const Elem *ptr, size_type len,
flag_type flags = ECMAScript);
template<class STtraits, class STalloc>
basic_regex& assign(const basic_string<Elem, STtraits, STalloc>& str,
flag_type flags = ECMAScript);
template<class InIt>
basic_regex& assign(InIt first, InIt last,
flag_type flags = ECMAScript);
locale_type imbue(locale_type loc);
locale_type getloc() const;
void swap(basic_regex& other) throw();
unsigned mark_count() const;
flag_type flags() const;
typedef Elem value_type;
typedef regex_constants::syntax_option_type flag_type;
typedef typename RXtraits::locale_type locale_type;
static const flag_type icase = regex_constants::icase;
static const flag_type nosubs = regex_constants::nosubs;
static const flag_type optimize = regex_constants::optimize;
static const flag_type collate = regex_constants::collate;
static const flag_type ECMAScript = regex_constants::ECMAScript;
static const flag_type basic = regex_constants::basic;
static const flag_type extended = regex_constants::extended;
static const flag_type awk = regex_constants::awk;
static const flag_type grep = regex_constants::grep;
static const flag_type egrep = regex_constants::egrep;
private:
RXtraits traits; // exposition only
};
basic_regex();
template<class STtraits, class STalloc>
explicit basic_regex(const basic_string<Elem, STtraits, STalloc>& str,
flag_type flags = ECMAScript);
template<class InIt>
explicit basic_regex(InIt first, InIt last,
flag_type flags = ECMAScript);
explicit basic_regex(const Elem *ptr,
flag_type flags = ECMAScript);
explicit basic_regex(const Elem *ptr, size_type len,
flag_type flags);
basic_regex(const basic_regex& right);
All constructors store a default-constructed object of type RXtraits.
The first constructor constructs an empty basic_regex object. The other constructors construct a basic_regex object that holds the regular expression described by the operand sequence.
An empty basic_regex object does not match any character sequence when passed to regex_match, regex_search, or regex_replace.
typedef regex_constants::syntax_option_type flag_type;
The type is a synonym for regex_constants::syntax_option_type.
typedef typename RXtraits::locale_type locale_type;
The type is a synonym for regex_traits::locale_type.
typedef Elem value_type;
The type is a synonym for the template parameter Elem.
basic_regex& assign(const basic_regex& right);
basic_regex& assign(const Elem *ptr,
flag_type flags = ECMAScript);
basic_regex& assign(const Elem *ptr, size_type len,
flag_type flags = ECMAScript);
template<class STtraits, class STalloc>
basic_regex& assign(const basic_string<Elem, STtraits, STalloc>& str,
flag_type flags = ECMAScript);
template<class InIt>
basic_regex& assign(InIt first, InIt last,
flag_type flags = ECMAScript);
The member functions each replace the regular expression held by *this with the regular expression described by the operand sequence, then return *this.
flag_type flags() const;
The member function returns the value of the flag_type argument passed to the most recent call to one of the assign member functions or, if no such call has been made, the value passed to the constructor.
locale_type getloc() const;
The member function returns traits.getloc().
locale_type imbue(locale_type loc);
The member function empties *this and returns traits.imbue(loc).
unsigned mark_count() const;
The member function returns the number of capture groups in the regular expression.
void swap(basic_regex& right) throw();
The member function swaps the regular expressions between *this and right. It does so in constant time and throws no exceptions.
static const flag_type awk = regex_constants::awk;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::awk.
static const flag_type basic = regex_constants::basic;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::basic.
static const flag_type collate = regex_constants::collate;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::collate.
static const flag_type ECMAScript = regex_constants::ECMAScript;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::ECMAScript.
static const flag_type egrep = regex_constants::egrep;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::egrep.
static const flag_type extended = regex_constants::extended;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::extended.
static const flag_type grep = regex_constants::grep;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::grep.
static const flag_type icase = regex_constants::icase;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::icase.
static const flag_type nosubs = regex_constants::nosubs;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::nosubs.
static const flag_type optimize = regex_constants::optimize;
The constant can be passed to the constructors or the assign member functions. It has the value regex_constants::optimize.
basic_regex& operator=(const basic_regex& right); basic_regex& operator=(const Elem *str); template<class STtraits, class STalloc> basic_regex& operator=(const basic_string<Elem, STtraits, STalloc>& str);
The operators each replace the regular expression held by *this with the regular expression described by the operand sequence, then return *this.
The template class describes an object that controls a non-modifiable sequence of elements of type sub_match<BidIt> generated by a regular expression search. Each element points to the subsequence that matched the capture group corresponding to that element.
template<class BidIt,
class Alloc = allocator<typename iterator_traits<BidIt>::value_type> >
class match_results {
public:
explicit match_results(const Alloc& alloc = Alloc());
match_results(const match_results& right);
match_results& operator=(const match_results& right);
difference_type position(size_type sub = 0) const;
difference_type length(size_type sub = 0) const;
string_type str(size_type sub = 0) const;
const_reference operator[](size_type n) const;
const_reference prefix() const;
const_reference suffix() const;
const_iterator begin() const;
const_iterator end() const;
template<class OutIt>
OutIt format(OutIt out,
const string_type& fmt,
match_flag_type flags = format_default) const;
string_type format(const string_type& fmt,
match_flag_type flags = format_default) const;
allocator_type get_allocator() const;
void swap(const match_results& other) throw();
size_type size() const;
size_type max_size() const;
bool empty() const;
typedef sub_match<BidIt> value_type;
typedef const typename Alloc::const_reference const_reference;
typedef const_reference reference;
typedef T0 const_iterator;
typedef const_iterator iterator;
typedef typename iterator_traits<BidIt>::difference_type difference_type;
typedef typename Alloc::size_type size_type;
typedef Alloc allocator_type;
typedef typename iterator_traits<BidIt>::value_type char_type;
typedef basic_string<char_type> string_type;
};
explicit match_results(const Alloc& alloc = Alloc()); match_results(const match_results& right);
The first constructor constructs a match_results object that holds no submatches. The second constructor constructs a match_results object that is a copy of right.
typedef Alloc allocator_type;
The typedef is a synonym for the template argument Alloc.
typedef typename iterator_traits<BidIt>::value_type char_type;
The typedef is a synonym for the type iterator_traits<BidIt>::value_type, which is the element type of the character sequence that was searched.
typedef T0 const_iterator;
The typedef describes an object that can server as a constant random-access iterator for the controlled sequence.
typedef const typename Alloc::const_reference const_reference;
The typedef describes an object that can serve as a constant reference to an element of the controlled sequence.
typedef typename iterator_traits<BidIt>::difference_type difference_type;
The typedef is a synonym for the type iterator_traits<BidIt>::difference_type; it describes an object that can represent the difference between any two iterators that point at elements of the controlled sequence.
typedef const_iterator iterator;
The type describes an object that can serve as a random-access iterator for the controlled sequence.
typedef const_reference reference;
The type is a synonym for the type const_reference.
typedef typename Alloc::size_type size_type;
The type is a synonym for the type Alloc::size_type.
typedef basic_string<char_type> string_type;
The type is a synonym for the type basic_string<char_type>.
typedef sub_match<BidIt> value_type;
The typedef is a synonym for the type sub_match<BidIt>.
const_iterator begin() const;
The member function returns a random access iterator that points at the first element of the sequence (or just beyond the end of an empty sequence).
bool empty() const;
The member function returns true only if the regular expression search failed.
const_iterator end() const;
The member function returns an iterator that points just beyond the end of the sequence.
template<class OutIt>
OutIt format(OutIt out,
const string_type& fmt,
match_flag_type flags = format_default) const;
string_type format(const string_type& fmt,
match_flag_type flags = format_default) const;
Each member function generates formatted text under the control of the format fmt. The first member function writes the formatted text to the sequence defined by its argument out and returns out. The second member function returns a string object holding a copy of the formatted text.
To generate formatted text literal text in the format string is ordinarily copied to the target sequence. Each escape sequence in the format string is replaced by the text that it represents. The details of the copying and replacement are controlled by the format flags passed to the function.
allocator_type get_allocator() const;
The member function returns a copy of the allocator object used by *this to allocate its sub_match objects.
difference_type length(size_type sub = 0) const;
The member function returns (*this)[sub].length().
size_type max_size() const;
The member function returns the length of the longest sequence that the object can control.
const_reference operator[](size_type n) const;
The member function returns a reference to element n of the controlled sequence, or a reference to an empty sub_match object if size() <= n or if the capture group n was not part of the match.
difference_type position(size_type sub = 0) const;
The member function returns std::distance(prefix().first, (*this)[sub].first), that is, the distance from the first character in the target sequence to the first character in the submatch pointed to by element n of the controlled sequence.
const_reference prefix() const;
The member function returns a reference to an object of type sub_match<BidIt> that points to the character sequence that begins at the start of the target sequence and ends at (*this)[0].first, that is, it points to the text that precedes the matched subsequence.
size_type size() const;
The member function returns one more than the number of capture groups in the regular expression that was used for the search, or 0 if no search has been made.
string_type str(size_type sub = 0) const;
The member function returns string_type((*this)[sub]).
const_reference suffix() const;
The member function returns a reference to an object of type sub_match<BidIt> that points to the character sequence that begins at (*this)[size() - 1].second and ends at the end of the target sequence, that is, it points to the text that follows the matched subsequence.
void swap(const match_results& right) throw();
The member function swaps the contents of *this and right in constant time and does not throw exceptions.
match_results& operator=(const match_results& right);
The member operator replaces the sequence controlled by *this with a copy of the sequence controlled by right.
The class describes an exception object thrown to report an error in the construction or use of a basic_regex object.
class regex_error : public std::runtime_error {
public:
explicit regex_error(regex_constants::error_code error);
regex_constants::error_code code() const;
};
regex_error(regex_constants::error_code error);
The constructor constructs an object that holds the value error.
regex_constants::error_code code() const;
The member function returns the value that was passed to the object's constructor.
The template class describes a constant forward iterator object. It extracts objects of type match_results<BidIt> by repeatedly applying its regular expression object *pregex to the character sequence defined by the iterator range [begin,end).
template<class BidIt, class Elem = iterator_traits<BidIt>::value_type,
class RXtraits = regex_traits<Elem> >
class regex_iterator {
public:
typedef basic_regex<Elem, RXtraits> regex_type;
typedef match_results<BidIt> value_type;
typedef std::forward_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
typedef const match_results<BidIt>* pointer;
typedef const match_results<BidIt>& reference;
regex_iterator();
regex_iterator(BidIt first, BidIt last, const regex_type& re,
regex_constants::match_flag_type f = regex_constants::match_default);
bool operator==(const regex_iterator& right);
bool operator!=(const regex_iterator& right);
const match_results<BidIt>& operator*();
const match_results<BidIt> *operator->();
regex_iterator& operator++();
regex_iterator& operator++(int);
BidIt begin; // exposition only
BidIt end; // exposition only
regex_type *pregex; // exposition only
regex_constants::match_flag_type flags; // exposition only
match_results<BidIt> match; // exposition only
};
regex_iterator();
regex_iterator(BidIt first, BidIt last,
const regex_type& re,
regex_constants::match_flag_type f = regex_constants::match_default);
The first constructor constructs an end-of-sequence iterator. The second constructor initializes the stored value begin with first, the stored value end with last, the stored value pregex with &re, and the stored value flags with f. It then calls regex_search(begin, end, match, *pregex, flags). If the search fails, the constructor sets the object to an end-of-sequence iterator.
typedef std::ptrdiff_t difference_type;
The type is a synonym for std::ptrdiff_t.
typedef std::forward_iterator_tag iterator_category;
The type is a synonym for std::forward_iterator_tag.
typedef match_results<BidIt> *pointer;
The type is a synonym for match_results<BidIt>*, where BidIt is the template parameter.
typedef match_results<BidIt>& reference;
The type is a synonym for match_results<BidIt>&, where BidIt is the template parameter.
typedef basic_regex<Elem, RXtraits> regex_type;
The typedef is a synonym for basic_regex<Elem, RXtraits>.
typedef match_results<BidIt> value_type;
The type is a synonym for match_results<BidIt>, where BidIt is the template parameter.
bool operator==(const regex_iterator& right);
The member function returns true if *this and right are both end-of-sequence iterators or if neither is an end-of-sequence iterator and begin == right.begin, end == right.end, pregex == right.pregex, and flags == right.flags. Otherwise it returns false.
bool operator!=(const regex_iterator& right);
The member function returns !(*this == right).
const match_results<BidIt>& operator*();
The member function returns the stored value match.
const match_results<BidIt> *operator->();
The member function returns the address of the stored value match.
regex_iterator& operator++(); regex_iterator& operator++(int);
If the current match has no characters the first operator calls regex_search(begin, end, match, *pregex, flags | regex_constants::match_prev_avail | regex_constants::match_not_null); otherwise it advances the stored value begin to point to the first character after the current match then calls regex_search(begin, end, match, *pregex, flags | regex_constants::match_prev_avail). In either case, if the search fails the operator sets the object to an end-of-sequence iterator. The operator returns the object.
The second operator makes a copy of the object, increments the object, then returns the copy.
The template class describes a constant forward iterator object. Conceptually, it holds a regex_iterator object that it uses to search for regular expression matches in a character sequence. It extracts objects of type sub_match<BidIt> representing the submatches identified by the index values in the stored vector subs for each regular expression match.
An index value of -1 designates the character sequence beginning immediately after the end of the previous regular expression match, or beginning at the start of the character sequence if there was no previous regular expression match, and extending to but not including the first character of the current regular expression match, or to the end of the character sequence if there is no current match. Any other index value idx designates the contents of the capture group held in it.match[idx].
template<class BidIt, class Elem = iterator_traits<BidIt>::value_type,
class RXtraits = regex_traits<Elem> >
class regex_token_iterator {
public:
typedef basic_regex<Elem, RXtraits> regex_type;
typedef sub_match<BidIt> value_type;
typedef std::forward_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
typedef const sub_match<BidIt> *pointer;
typedef const sub_match<BidIt>& reference;
regex_token_iterator();
regex_token_iterator(BidIt first, BidIt last,
const regex_type& re, int submatch = 0,
regex_constants::match_flag_type f = regex_constants::match_default);
regex_token_iterator(BidIt first, BidIt last,
const regex_type& re, const std::vector<int> submatches,
regex_constants::match_flag_type f = regex_constants::match_default);
template<std::size_t N>
regex_token_iterator(BidIt first, BidIt last,
const regex_type& re, const int (&submatches)[N],
regex_constants::match_flag_type f = regex_constants::match_default);
bool operator==(const regex_token_iterator& right);
bool operator!=(const regex_token_iterator& right);
const basic_string<Elem>& operator*();
const basic_string<Elem> *operator->();
regex_token_iterator& operator++();
regex_token_iterator& operator++(int);
private:
regex_iterator<BidIt, Elem, RXtraits> it; // exposition only
vector<int> subs; // exposition only
int pos; // exposition only
};
regex_token_iterator();
regex_token_iterator(BidIt first, BidIt last,
const regex_type& re, int submatch = 0,
regex_constants::match_flag_type f = regex_constants::match_default);
regex_token_iterator(BidIt first, BidIt last,
const regex_type& re, const vector<int> submatches,
regex_constants::match_flag_type f = regex_constants::match_default);
template<std::size_t N>
regex_token_iterator(BidIt first, BidIt last,
const regex_type& re, const int (&submatches)[N],
regex_constants::match_flag_type f = regex_constants::match_default);
The first constructor constructs an end-of-sequence iterator.
The second constructor constructs an object whose stored iterator it is initialized to regex_iterator<BidIt, Elem, RXtraits<(first, last, re, f), whose stored vector subs holds exactly one integer, with value submatch, and whose stored value pos is 0. Note: the resulting object extracts the submatch identified by the index value submatch for each successful regular expression match.
The third constructor constructs an object whose stored iterator it is initialized to regex_iterator<BidIt, Elem, RXtraits<(first, last, re, f), whose stored vector subs holds a copy of the constructor argument submatches, and whose stored value pos is 0.
The fourth constructor constructs an object whose stored iterator it is initialized to regex_iterator<BidIt, Elem, RXtraits<(first, last, re, f), whose stored vector subs holds the N values pointed to by the constructor argument submatches, and whose stored value pos is 0.
typedef std::ptrdiff_t difference_type;
The type is a synonym for std::ptrdiff_t.
typedef std::forward_iterator_tag iterator_category;
The type is a synonym for std::forward_iterator_tag.
typedef sub_match<BidIt> *pointer;
The type is a synonym for sub_match<BidIt>*, where BidIt is the template parameter.
typedef sub_match<BidIt>& reference;
The type is a synonym for sub_match<BidIt>&, where BidIt is the template parameter.
typedef basic_regex<Elem, RXtraits> regex_type;
The typedef is a synonym for basic_regex<Elem, RXtraits>.
typedef sub_match<BidIt> value_type;
The type is a synonym for sub_match<BidIt>, where BidIt is the template parameter.
bool operator==(const regex_token_iterator& right);
The member function returns it == right.it && subs == right.subs && pos == right.pos.
bool operator!=(const regex_token_iterator& right);
The member function returns !(*this == right).
const sub_match<BidIt>& operator*();
The member function returns a sub_match<BidIt> object representing the capture group identified by the index value subs[pos].
const sub_match<BidIt> *operator->();
The member function returns a pointer to a sub_match<BidIt> object representing the capture group identified by the index value subs[pos].
regex_token_iterator& operator++(); regex_token_iterator& operator++(int);
If the stored iterator it is an end-of-sequence iterator the first operator sets the stored value pos to the value of subs.size() (thus making an end-of-sequence iterator). Otherwise the operator increments the stored value pos; if the result is equal to the value subs.size() it sets the stored value pos to 0 and increments the stored iterator it. If incrementing the stored iterator leaves it unequal to an end-of-sequence iterator the operator does nothing further. Otherwise, if the end of the preceding match was at the end of the character sequence the operator sets the stored value of pos to subs.size(). Otherwise, the operator repeatedly increments the stored value pos until pos == subs.size() or subs[pos] == -1 (thus ensuring that the next dereference of the iterator will return the tail of the character sequence if one of the index values is -1). In all cases the operator returns the object.
The second operator makes a copy of the object, increments the object, then returns the copy.
The template class describes various regular expression traits for type Elem. The template class basic_regex uses this information to manipulate elements of type Elem.
Each regex_traits object holds an object of type regex_traits::locale which is used by some of its member functions. The default locale is a copy of regex_traits::locale(). The member function imbue replaces the locale object, and the member function getloc returns a copy of the locale object.
template<class Elem>
struct regex_traits {
regex_traits();
static size_type length(const char_type *str);
char_type translate(char_type ch) const;
char_type translate_nocase(char_type ch) const;
template<class FwdIt>
string_type transform(FwdIt first, FwdIt last) const;
template<class FwdIt>
string_type transform_primary(FwdIt first, FwdIt last) const;
template<class FwdIt>
char_class_type lookup_classname(FwdIt first, FwdIt last) const;
template<class FwdIt>
string_type lookup_collatename(FwdIt first, FwdIt last) const;
bool isctype(char_type ch, char_class_type cls) const;
int value(Elem ch, int base) const;
locale_type imbue(locale_type loc);
locale_type getloc() const;
typedef Elem char_type;
typedef T6 size_type;
typedef basic_string<Elem> string_type;
typedef T7 locale_type;
typedef T8 char_class_type;
};
regex_traits();
The constructor constructs an object whose stored locale object is initialized to the default locale.
typedef T8 char_class_type;
The type is a synonym for an unspecified type that designates character classes. Values of this type can be combined using the | operator to designate character classes that are the union of the classes designated by the operands.
typedef Elem char_type;
The typedef is a synonym for the template argument Elem.
typedef T7 locale_type;
The typedef is a synonym for a type that encapsulates locales. In the specializations regex_traits<char> and regex_traits<wchar_t> it is a synonym for std::locale.
typedef T6 size_type;
The typedef is a synonym for an unsigned integral type. In the specializations regex_traits<char> and regex_traits<wchar_t> it is a synonym for std::size_t.
The typedef is a synonym for std::size_t.
typedef basic_string<Elem> string_type;
The typedef is a synonym for basic_string<Elem>.
locale_type getloc() const;
The member function returns the stored locale object.
locale_type imbue(locale_type loc);
The member function copies loc to the stored locale object and returns a copy of the previous value of the stored locale object.
bool isctype(char_type ch, char_class_type cls) const;
The member function returns true only if the character ch is in the character class designated by cls.
static size_type length(const char_type *str);
The static member function returns std::char_traits<char_type>::length(str).
template<class FwdIt>
char_class_type lookup_classname(FwdIt first, FwdIt last) const;
The member function returns a value that designates the character class named by the character sequence pointed to by its arguments. The value does not depend on the case of the characters in the sequence.
The specialization regex_traits<char> recognizes the names “d”, “s”, “w”, “alnum”, “alpha”, “blank”, “cntrl”, “digit”, “graph”, “lower”, “print”, “punct”, “space”, “upper”, and “xdigit”, all without regard to case.
The specialization regex_traits<wchar_t> recognizes the names L“d”, L“s”, L“w”, L“alnum”, L“alpha”, L“blank”, L“cntrl”, L“digit”, L“graph”, L“lower”, L“print”, L“punct”, L“space”, L“upper”, and L“xdigit”, all without regard to case.
template<class FwdIt> string_type lookup_collatename(FwdIt first, FwdIt last) const;
xxx
int value(Elem ch, int radix) const;
The member function returns the value represented by the character ch in the base radix, or -1 if ch is not a valid digit in the base radix. The function will only be called with a radix argument of 8, 10, or 16.
template<class FwdIt> string_type transform(FwdIt first, FwdIt last) const;
The member function returns a string that it generates by using a transformation rule that depends on the stored locale object. For two character sequences designated by the iterator ranges [first1, last1) and [first2, last2), transform(first1, last1) < transform(first2, last2) if the character sequence designated by the iterator range [first1, last1) sorts before the character sequence designated by the iterator range [first2, last2).
template<class FwdIt> string_type transform_primary(FwdIt first, FwdIt last) const;
The member function returns a string that it generates by using a transformation rule that depends on the stored locale object. For two character sequences designated by the iterator ranges [first1, last1) and [first2, last2), transform_primary(first1, last1) < transform_primary(first2, last2) if the character sequence designated by the iterator range [first1, last1) sorts before the character sequence designated by the iterator range [first2, last2) without regard for case or accents.
char_type translate(char_type ch) const;
The member function returns a character that it generates by using a transformation rule that depends on the stored locale object. For two char_type objects ch1 and ch2, translate(ch1) == translate(ch2) only if ch1 and ch2 should match when one occurs in the regular expression definition and the other occurs at a corresponding position in the target sequence for a (locale-sensitive) match.
char_type translate_nocase(char_type ch) const;
The member function returns a character that it generates by using a transformation rule that depends on the stored locale object. For two char_type objects ch1 and ch2, translate_nocase(ch1) == translate_nocase(ch2) only if ch1 and ch2 should match when one occurs in the regular expression definition and the other occurs at a corresponding position in the target sequence for a (case-insensitive) match.
template <>
class regex_traits<char>
The class is an explicit specialization of template class regex_traits for elements of type char (so that it can take advantage of library functions that manipulate objects of this type).
template <>
class regex_traits<wchar_t>
The class is an explicit specialization of template class regex_traits for elements of type wchar_t (so that it can take advantage of library functions that manipulate objects of this type).
The template class describes an object that designates a sequence of characters that matched a capture group in a call to regex_match or to regex_search. Objects of type match_results hold an array of these objects, one for each capture group in the regular expression that was used in the search.
If the capture group was not matched the object's data member matched holds false, and the two iterators first and second (inherited from the base std::pair) are equal. If the capture group was matched, matched holds true, the iterator first points to the first character in the target sequence that matched the capture group, and the iterator second points one position past the last character in the target sequence that matched the capture group. Note that for a zero-length match the member matched holds true, the two iterators will be equal, and both will point to the position of the match.
A zero-length match can occur when a capture group consists solely of an assertion, or of a repetition that allows zero repeats. For example:
template<class BidIt>
class sub_match : public std::pair<BidIt, BidIt>{
public:
bool matched;
int compare(const sub_match& right) const;
int compare(const basic_string<value_type>& right) const;
int compare(const value_type *right) const;
difference_type length() const;
operator basic_string<value_type>() const;
basic_string<value_type> str() const;
typedef typename iterator_traits<BidIt>::value_type value_type;
typedef typename iterator_traits<BidIt>::difference_type difference_type;
typedef BidIt iterator;
};
typedef typename iterator_traits<BidIt>::difference_type difference_type;
The typedef is a synonym for iterator_traits<BidIt>::difference_type.
typedef BidIt iterator;
The typedef is a synonym for the template type argument Bidit.
typedef typename iterator_traits<BidIt>::value_type value_type;
The typedef is a synonym for iterator_traits<BidIt>::value_type.
int compare(const sub_match& right) const; int compare(const basic_string<value_type>& right) const; int compare(const value_type *right) const;
The first member function compares the matched sequence [first, second) to the matched sequence [right.first, right.second). The second member function compares the matched sequence [first, second) to the character sequence [right.begin(), right.end()). The third member function compares the matched sequence [first, second) to the character sequence [right, right + std::char_traits<value_type>::length(right)).
Each function returns:
difference_type length() const;
The member function returns the length of the matched sequence, or 0 if there was no matched sequence.
basic_string<value_type> str() const;
The member function returns basic_string<value_type>(first, second).
bool matched;
The member holds true only if the capture group associated with *this was part of the regular expression match.
operator basic_string<value_type>() const;
The member operator returns str().
template<class BidIt, class Alloc, class Elem, class RXtraits, class Alloc2>
bool regex_match(BidIt first, Bidit last,
match_results<BidIt, Alloc>& match,
const basic_regex<Elem, RXtraits, Alloc2>& re,
match_flag_type flags = match_default);
template<class BidIt, class Elem, class RXtraits, class Alloc2>
bool regex_match(BidIt first, Bidit last,
const basic_regex<Elem, RXtraits, Alloc2>& re,
match_flag_type flags = match_default);
template<class Elem, class Alloc, class RXtraits, class Alloc2>
bool regex_match(const Elem *ptr,
match_results<const Elem*, Alloc>& match,
const basic_regex<Elem, RXtraits, Alloc2>& re,
match_flag_type flags = match_default);
template<class Elem, class RXtraits, class Alloc2>
bool regex_match(const Elem *ptr,
const basic_regex<Elem, RXtraits, Alloc2>& re,
match_flag_type flags = match_default);
template<class IOtraits, class IOalloc, class Alloc, class Elem,
class RXtraits, class Alloc2>
bool regex_match(
const basic_string<Elem, IOtraits, IOalloc>& str,
match_results<typename basic_string<Elem, IOtraits, IOalloc>::const_iterator,
Alloc>& match,
const basic_regex<Elem, RXtraits, Alloc2>& re,
match_flag_type flags = match_default);
template<class IOtraits, class IOalloc, class Elem, class RXtraits, class Alloc2>
bool regex_match(const basic_string<Elem, IOtraits, IOalloc>& str,
const basic_regex<Elem, RXtraits, Alloc2>& re,
match_flag_type flags = match_default);
Each template function returns true only if its operand sequence exactly matches its regular expression argument re. The functions that take a match_results object set its members to reflect whether the match succeeded and if so what the various capture groups in the regular expression captured.
template<class OutIt, class BidIt, class RXtraits, class Alloc, class Elem>
OutIt regex_replace(OutIt out,
BidIt first, BidIt last,
const basic_regex<Elem, RXtraits, Alloc>& re,
const basic_string<Elem>& fmt,
match_flag_type flags = match_default);
template<class RXtraits, class Alloc, class Elem>
basic_string<Elem> regex_replace(const basic_string<Elem>& str,
const basic_regex<Elem, RXtraits, Alloc>& re,
const basic_string<Elem>& fmt,
match_flag_type flags = match_default);
The first function constructs a regex_iterator object iter(first, last, re, flags) and uses it to split its input range [first, last) into a series of subsequences T0M0T1M1...TN-1MN-1TN, where Mn is the nth match detected by the iterator. If no matches are found, T0 is the entire input range and N is 0. If (flags & format_first_only) != 0 only the first match is used, T1 is all of the input text that follows the match, and N is 1. For each i in the range [0, N), if (flags & format_no_copy) == 0 it copies the text in the range Ti to the iterator out. It then calls m.format(out, fmt, flags), where m is the match_results object returned by the iterator object iter for the subsequence Mi. Finally, if (flags & format_no_copy) == 0 it copies the text in the range TN to the iterator out. The function returns out.
The second function constructs a local variable result of type basic_string<charT> and calls regex_replace(back_inserter(result), str.begin(), str.end(), re, fmt, flags). It returns result.
template<class BidIt, class Alloc, class Elem, class RXtraits>
bool regex_search(BidIt first, Bidit last,
match_results<BidIt, Alloc>& match,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class BidIt, class Elem, class RXtraits>
bool regex_search(BidIt first, Bidit last,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class Elem, class Alloc, class RXtraits>
bool regex_search(const Elem* ptr,
match_results<const Elem*, Alloc>& match,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class Elem, class RXtraits>
bool regex_search(const Elem* ptr,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class IOtraits, class IOalloc, class Alloc, class Elem, class RXtraits>
bool regex_search(
const basic_string<Elem, IOtraits, IOalloc>& str,
match_results<typename basic_string<Elem, IOtraits, IOalloc>::
const_iterator, Alloc>& match, const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
template<class IOtraits, class IOalloc, class Elem, class RXtraits
> bool regex_search(
const basic_string<Elem, IOtraits, IOalloc>& str,
const basic_regex<Elem, RXtraits>& re,
match_flag_type flags = match_default);
Each template function returns true only if a search for its regular expression argument re in its operand sequence succeeds. The functions that take a match_results object set its members to reflect whether the search succeeded and if so what the various capture groups in the regular expression captured.
template<class Elem, class RXtraits>
void swap(basic_regex<Elem, RXtraits, Alloc>& left,
basic_regex<Elem, RXtraits>& right) throw();
template<class Elem, class IOtraits, class BidIt, class Alloc>
void swap(match_results<BidIt, Alloc>& left,
match_results<BidIt, Alloc>& right) throw();
The template functions swap the contents of their respective arguments in constant time and do not throw exceptions.
typedef match_results<const char*> cmatch;
The type describes a specialization of template class match_results for iterators of type const char*.
typedef regex_iterator<const char*> cregex_iterator;
The type describes a specialization of template class regex_iterator for iterators of type const char*.
typedef regex_token_iterator<const char*> cregex_token_iterator;
The type describes a specialization of template class regex_token_iterator for iterators of type const char*.
typedef sub_match<const char*> csub_match;
The type describes a specialization of template class sub_match for iterators of type const char*.
typedef basic_regex<char> regex;
The type describes a specialization of template class basic_regex for elements of type char.
namespace regex_constants {
typedef T1 syntax_option_type;
typedef T2 match_flag_type;
typedef T3 error_type;
}
typedef T3 error_type; static const error_type error_badbrace, error_badrepeat, error_brace, error_brack, error_collate, error_complexity, error_ctype, error_escape, error_paren, error_range, error_space, error_stack, error_backref;
The type is an enumerated type that describes an object that can hold error flags. The distinct flag values are:
typedef T2 match_flag_type; static const match_flag_type match_any, match_default, match_not_bol, match_not_bow, match_continuous, match_not_eol, match_not_eow, match_not_null, match_partial, match_prev_avail;
The type is a bitmask type that describes options to be used when matching a text sequence against a regular expression and format flags to be used when replacing text. Options can be combined with |.
The match options are:
typedef T1 syntax_option_type; static const syntax_option_type awk, basic, collate, ECMAScript, egrep, extended, grep, icase, nosubs, optimize;
The type is a bitmask type that describes language specifiers and syntax modifiers to be used when compiling a regular expression. Options can be combined with |. No more than one language specifier should be used at a time.
The language specifiers are:
The syntax modifiers are:
typedef match_results<string::const_iterator> smatch;
The type describes a specialization of template class match_results for iterators of type string::const_iterator.
typedef regex_iterator<string::const_iterator> sregex_iterator;
The type describes a specialization of template class regex_iterator for iterators of type string::const_iterator.
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
The type describes a specialization of template class regex_token_iterator for iterators of type string::const_iterator.
typedef sub_match<string::const_iterator> ssub_match;
The type describes a specialization of template class sub_match for iterators of type string::const_iterator.
typedef match_results<const wchar_t *> wcmatch;
The type describes a specialization of template class match_results for iterators of type const wchar_t*.
typedef regex_iterator<const wchar_t*> wcregex_iterator;
The type describes a specialization of template class regex_iterator for iterators of type const wchar_t*.
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
The type describes a specialization of template class regex_token_iterator for iterators of type const wchar_t*.
typedef sub_match<const wchar_t*> wcsub_match;
The type describes a specialization of template class sub_match for iterators of type const wchar_t*.
typedef match_results<wstring::const_iterator> wsmatch;
The type describes a specialization of template class match_results for iterators of type wstring::const_iterator.
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
The type describes a specialization of template class regex_iterator for iterators of type wstring::const_iterator.
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
The type describes a specialization of template class regex_token_iterator for iterators of type wstring::const_iterator.
typedef sub_match<wstring::const_iterator> wssub_match;
The type describes a specialization of template class sub_match for iterators of type wstring::const_iterator.
typedef basic_regex<wchar_t> wregex;
The type describes a specialization of template class basic_regex for elements of type wchar_t.
template<class BidIt>
bool operator==(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator==(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator==(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt>
bool operator==(
const typename iterator_traits<BidIt>::value_type* left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator==(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type* right);
template<class BidIt>
bool operator==(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator==(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
template<class BidIt, class Alloc>
bool operator==(
const match_results<BidIt, Alloc>& left,
const match_results<BidIt, Alloc>& right);
Each template operator converts each of its arguments to a string type and returns the result of comparing the converted objects for equality.
When a template operator converts its arguments to a string type it uses the first of the following transformations that applies:
template<class BidIt>
bool operator!=(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator!=(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator!=(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt>
bool operator!=(
const typename iterator_traits<BidIt>::value_type *left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator!=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type *right);
template<class BidIt>
bool operator!=(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator!=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
template<class BidIt, class Alloc>
bool operator!=(
const match_results<BidIt, Alloc>& left,
const match_results<BidIt, Alloc>& right);
Each template operator returns !(left == right).
template<class BidIt>
bool operator<(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator<(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator<(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt>
bool operator<(
const typename iterator_traits<BidIt>::value_type *left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type *right);
template<class BidIt>
bool operator<(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
Each template operator converts its arguments to a string type and returns true only if the converted value of left compares less than the converted value of right.
template<class BidIt>
bool operator<=(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator<=(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator<=(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt>
bool operator<=(
const typename iterator_traits<BidIt>::value_type *left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type *right);
template<class BidIt>
bool operator<=(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator<=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
Each template operator returns !(right < left).
template<class BidIt>
bool operator>(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator>(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator>(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt>
bool operator>(
const typename iterator_traits<BidIt>::value_type *left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type *right);
template<class BidIt>
bool operator>(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
Each template operator returns right < left.
template<class BidIt>
bool operator>=(
const sub_match<BidIt>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator>=(
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& left,
const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
bool operator>=(
const sub_match<BidIt>& left,
const basic_string<typename iterator_traits<BidIt>::value_type,
IOtraits, Alloc>& right);
template<class BidIt>
bool operator>=(
const typename iterator_traits<BidIt>::value_type *left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type *right);
template<class BidIt>
bool operator>=(
const typename iterator_traits<BidIt>::value_type& left,
const sub_match<BidIt>& right);
template<class BidIt>
bool operator>=(
const sub_match<BidIt>& left,
const typename iterator_traits<BidIt>::value_type& right);
Each template operator returns !(left < right).
template<class Elem, class IOtraits, class Alloc, class BidIt>
basic_ostream<Elem, IOtraits>&
operator<<(
basic_ostream<Elem, IOtraits>& os,
const sub_match<BidIt>& right);
The template operator returns os << right.str().
Certain materials included or referred to in this document are copyright P.J. Plauger and/or Dinkumware, Ltd. or are based on materials that are copyright P.J. Plauger and/or Dinkumware, Ltd.
Notwithstanding the meta-data for this document, copyright information for this document is as follows:
Copyright © IBM Corp. 1999, 2010. & Copyright © P.J. Plauger and/or Dinkumware, Ltd. 1992-2006.