# tr1_impl/regex File Reference

The common implementation file for tr1 and std regular expressions. More...

Go to the source code of this file.

## Classes

- class std::basic_regex< _Ch_type, _Rx_traits >
- class std::match_results< _Bi_iter, _Allocator >
    The results of a match or search operation. More...
- class std::regex_error
    A regular expression exception class.

    The regular expression library throws objects of this class on error. More...

- class std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >
- class std::regex_token_iterator< _Bi_iter, _Ch_type, _Rx_traits >
- struct std::regex_traits< _Ch_type >
    Describes aspects of a regular expression. More...
- class std::sub_match< _BiIter >

## Namespaces

- namespace std
- namespace std::regex_constants

## Typedefs

- typedef match_results< const
  char * > std::cmatch
- typedef regex_iterator< const
  char * > std::cregex_iterator
- typedef regex_token_iterator
  < const char * > std::cregex_token_iterator
- typedef sub_match< const char * > std::csub_match
- typedef basic_regex< char > std::regex
- typedef match_results
  < string::const_iterator > std::smatch
- typedef regex_iterator
  < string::const_iterator > std::sregex_iterator
- typedef regex_token_iterator
  < string::const_iterator > std::sregex_token_iterator
- typedef sub_match
  < string::const_iterator > std::ssub_match
- typedef match_results< const
  wchar_t * > std::wcmatch
- typedef regex_iterator< const
  wchar_t * > std::wcregex_iterator
- typedef regex_token_iterator
  < const wchar_t * > std::wcregex_token_iterator
- typedef sub_match< const
  wchar_t * > std::wcsub_match
- typedef basic_regex< wchar_t > std::wregex
- typedef match_results
  < wstring::const_iterator > std::wsmatch
- typedef regex_iterator
  < wstring::const_iterator > std::wsregex_iterator
- typedef regex_token_iterator
  < wstring::const_iterator > std::wsregex_token_iterator
- typedef sub_match
  < wstring::const_iterator > std::wssub_match

## Functions

- template<typename _Bi_iter , class _Allocator > bool std::operator!= (const match_results< _Bi_iter, _Allocator > &__m1, const match_results< _Bi_iter, _Allocator > &__m2)
- template<typename _Bi_iter > bool std::operator!= (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
- template<typename _Bi_iter > bool std::operator!= (typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter > bool std::operator!= (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
- template<typename _Bi_iter > bool std::operator!= (typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter , typename _Ch_traits , typename _Ch_alloc > bool std::operator!= (const sub_match< _Bi_iter > &__lhs, const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__rhs)
- template<typename _Bi_iter , typename _Ch_traits , typename _Ch_alloc > bool std::operator!= (const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _BiIter > bool std::operator!= (const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
- template<typename _Bi_iter > bool std::operator< (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
- template<typename _Bi_iter > bool std::operator< (typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter > bool std::operator< (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
- template<typename _Bi_iter > bool std::operator< (typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter , class _Ch_traits , class _Ch_alloc > bool std::operator< (const sub_match< _Bi_iter > &__lhs, const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__rhs)
- template<typename _Bi_iter , typename _Ch_traits , typename _Ch_alloc > bool std::operator< (const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _BiIter > bool std::operator< (const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
- template<typename _Ch_type , typename _Ch_traits , typename _Bi_iter > basic_ostream< _Ch_type,
  _Ch_traits > & std::operator<< (basic_ostream< _Ch_type, _Ch_traits > &__os, const sub_match< _Bi_iter > &__m)
- template<typename _Bi_iter > bool std::operator<= (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
- template<typename _Bi_iter > bool std::operator<= (typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter > bool std::operator<= (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
- template<typename _Bi_iter > bool std::operator<= (typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter , class _Ch_traits , class _Ch_alloc > bool std::operator<= (const sub_match< _Bi_iter > &__lhs, const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__rhs)
- template<typename _Bi_iter , typename _Ch_traits , typename _Ch_alloc > bool std::operator<= (const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _BiIter > bool std::operator<= (const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
- template<typename _Bi_iter , typename _Allocator > bool std::operator== (const match_results< _Bi_iter, _Allocator > &__m1, const match_results< _Bi_iter, _Allocator > &__m2)
- template<typename _Bi_iter > bool std::operator== (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
- template<typename _Bi_iter > bool std::operator== (typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter > bool std::operator== (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
- template<typename _Bi_iter > bool std::operator== (typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter , typename _Ch_traits , typename _Ch_alloc > bool std::operator== (const sub_match< _Bi_iter > &__lhs, const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__rhs)
- template<typename _Bi_iter , typename _Ch_traits , typename _Ch_alloc > bool std::operator== (const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _BiIter > bool std::operator== (const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
- template<typename _Bi_iter > bool std::operator> (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
- template<typename _Bi_iter > bool std::operator> (typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter > bool std::operator> (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
- template<typename _Bi_iter > bool std::operator> (typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter , class _Ch_traits , class _Ch_alloc > bool std::operator> (const sub_match< _Bi_iter > &__lhs, const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__rhs)
- template<typename _Bi_iter , typename _Ch_traits , typename _Ch_alloc > bool std::operator> (const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _BiIter > bool std::operator> (const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
- template<typename _Bi_iter > bool std::operator>= (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
- template<typename _Bi_iter > bool std::operator>= (typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter > bool std::operator>= (const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
- template<typename _Bi_iter > bool std::operator>= (typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _Bi_iter , class _Ch_traits , class _Ch_alloc > bool std::operator>= (const sub_match< _Bi_iter > &__lhs, const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__rhs)
- template<typename _Bi_iter , typename _Ch_traits , typename _Ch_alloc > bool std::operator>= (const basic_string< typename iterator_traits< _Bi_iter >::value_type, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
- template<typename _BiIter > bool std::operator>= (const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
- template<typename _Bi_iter , typename _Allocator > void std::swap (match_results< _Bi_iter, _Allocator > &__lhs, match_results< _Bi_iter, _Allocator > &__rhs)
- template<typename _Ch_type , typename _Rx_traits > void std::swap (basic_regex< _Ch_type, _Rx_traits > &__lhs, basic_regex< _Ch_type, _Rx_traits > &__rhs)

Matching, Searching, and Replacing

- template<typename _Ch_traits , typename _Str_allocator , typename _Ch_type , typename _Rx_traits > bool std::regex_match (const basic_string< _Ch_type, _Ch_traits, _Str_allocator > &__s, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
- template<typename _Ch_type , class _Rx_traits > bool std::regex_match (const _Ch_type *__s, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __f=regex_constants::match_default)
- template<typename _Ch_traits , typename _Ch_alloc , typename _Allocator , typename _Ch_type , typename _Rx_traits > bool std::regex_match (const basic_string< _Ch_type, _Ch_traits, _Ch_alloc > &__s, match_results< typename basic_string< _Ch_type, _Ch_traits, _Ch_alloc >::const_iterator, _Allocator > &__m, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
- template<typename _Ch_type , typename _Allocator , typename _Rx_traits > bool std::regex_match (const _Ch_type *__s, match_results< const _Ch_type *, _Allocator > &__m, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __f=regex_constants::match_default)
- template<typename _Bi_iter , typename _Ch_type , typename _Rx_traits > bool std::regex_match (_Bi_iter __first, _Bi_iter __last, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
- template<typename _Bi_iter , typename _Allocator , typename _Ch_type , typename _Rx_traits > bool std::regex_match (_Bi_iter __first, _Bi_iter __last, match_results< _Bi_iter, _Allocator > &__m, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
- template<typename _Rx_traits , typename _Ch_type > basic_string< _Ch_type > std::regex_replace (const basic_string< _Ch_type > &__s, const basic_regex< _Ch_type, _Rx_traits > &__e, const basic_string< _Ch_type > &__fmt, regex_constants::match_flag_type __flags=regex_constants::match_default)
- template<typename _Out_iter , typename _Bi_iter , typename _Rx_traits , typename _Ch_type > _Out_iter std::regex_replace (_Out_iter __out, _Bi_iter __first, _Bi_iter __last, const basic_regex< _Ch_type, _Rx_traits > &__e, const basic_string< _Ch_type > &__fmt, regex_constants::match_flag_type __flags=regex_constants::match_default)
- template<typename _Ch_traits , typename _Ch_alloc , typename _Allocator , typename _Ch_type , typename _Rx_traits > bool std::regex_search (const basic_string< _Ch_type, _Ch_traits, _Ch_alloc > &__s, match_results< typename basic_string< _Ch_type, _Ch_traits, _Ch_alloc >::const_iterator, _Allocator > &__m, const basic_regex< _Ch_type, _Rx_traits > &__e, regex_constants::match_flag_type __f=regex_constants::match_default)
- template<typename _Ch_traits , typename _String_allocator , typename _Ch_type , typename _Rx_traits > bool std::regex_search (const basic_string< _Ch_type, _Ch_traits, _String_allocator > &__s, const basic_regex< _Ch_type, _Rx_traits > &__e, regex_constants::match_flag_type __flags=regex_constants::match_default)
- template<typename _Ch_type , typename _Rx_traits > bool std::regex_search (const _Ch_type *__s, const basic_regex< _Ch_type, _Rx_traits > &__e, regex_constants::match_flag_type __f=regex_constants::match_default)
- template<typename _Ch_type , class _Allocator , class _Rx_traits > bool std::regex_search (const _Ch_type *__s, match_results< const _Ch_type *, _Allocator > &__m, const basic_regex< _Ch_type, _Rx_traits > &__e, regex_constants::match_flag_type __f=regex_constants::match_default)
- template<typename _Bi_iter , typename _Ch_type , typename _Rx_traits > bool std::regex_search (_Bi_iter __first, _Bi_iter __last, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
- template<typename _Bi_iter , typename _Allocator , typename _Ch_type , typename _Rx_traits > bool std::regex_search (_Bi_iter __first, _Bi_iter __last, match_results< _Bi_iter, _Allocator > &__m, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)

## 5.2 Matching Rules

Matching a regular expression against a sequence of characters [first, last) proceeds according to the rules of the grammar specified for the regular expression object, modified according to the effects listed below for any bitmask elements set.

- enum std::regex_constants::__match_flag {
  _S_not_bol, _S_not_eol, _S_not_bow, _S_not_eow,
  _S_any, _S_not_null, _S_continuous, _S_prev_avail,
  _S_sed, _S_no_copy, _S_first_only, _S_match_flag_last
  }
- typedef std::bitset
  < _S_match_flag_last > std::regex_constants::match_flag_type
- static const match_flag_type std::regex_constants::format_default
- static const match_flag_type std::regex_constants::format_first_only
- static const match_flag_type std::regex_constants::format_no_copy
- static const match_flag_type std::regex_constants::format_sed
- static const match_flag_type std::regex_constants::match_any
- static const match_flag_type std::regex_constants::match_continuous
- static const match_flag_type std::regex_constants::match_default
- static const match_flag_type std::regex_constants::match_not_bol
- static const match_flag_type std::regex_constants::match_not_bow
- static const match_flag_type std::regex_constants::match_not_eol
- static const match_flag_type std::regex_constants::match_not_eow
- static const match_flag_type std::regex_constants::match_not_null
- static const match_flag_type std::regex_constants::match_prev_avail

## 5.1 Regular Expression Syntax Options

- enum std::regex_constants::__syntax_option {
  _S_icase, _S_nosubs, _S_optimize, _S_collate,
  _S_ECMAScript, _S_basic, _S_extended, _S_awk,
  _S_grep, _S_egrep, _S_syntax_last
  }
- typedef unsigned int std::regex_constants::syntax_option_type
- static const syntax_option_type std::regex_constants::awk
- static const syntax_option_type std::regex_constants::basic
- static const syntax_option_type std::regex_constants::collate
- static const syntax_option_type std::regex_constants::ECMAScript
- static const syntax_option_type std::regex_constants::egrep
- static const syntax_option_type std::regex_constants::extended
- static const syntax_option_type std::regex_constants::grep
- static const syntax_option_type std::regex_constants::icase
- static const syntax_option_type std::regex_constants::nosubs
- static const syntax_option_type std::regex_constants::optimize

## 5.3 Error Types

- enum std::regex_constants::error_type {
  _S_error_collate, _S_error_ctype, _S_error_escape, _S_error_backref,
  _S_error_brack, _S_error_paren, _S_error_brace, _S_error_badbrace,
  _S_error_range, _S_error_space, _S_error_badrepeat, _S_error_complexity,
  _S_error_stack, _S_error_last
  }
- static const error_type std::regex_constants::error_backref (_S_error_backref)
- static const error_type std::regex_constants::error_badbrace (_S_error_badbrace)
- static const error_type std::regex_constants::error_badrepeat (_S_error_badrepeat)
- static const error_type std::regex_constants::error_brace (_S_error_brace)
- static const error_type std::regex_constants::error_brack (_S_error_brack)
- static const error_type std::regex_constants::error_collate (_S_error_collate)
- static const error_type std::regex_constants::error_complexity (_S_error_complexity)
- static const error_type std::regex_constants::error_ctype (_S_error_ctype)
- static const error_type std::regex_constants::error_escape (_S_error_escape)
- static const error_type std::regex_constants::error_paren (_S_error_paren)
- static const error_type std::regex_constants::error_range (_S_error_range)
- static const error_type std::regex_constants::error_space (_S_error_space)
- static const error_type std::regex_constants::error_stack (_S_error_stack)

## Detailed Description

The common implementation file for tr1 and std regular expressions.

This is an internal header file, included by other library headers. You should not attempt to use it directly.

Definition in file tr1_impl/regex.