Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Struct template basic_regex

boost::xpressive::basic_regex — Class template basic_regex<> is a class for holding a compiled regular expression.

Synopsis

// In header: <boost/xpressive/basic_regex.hpp>

template<typename BidiIter> 
struct basic_regex {
  // types
  typedef BidiIter                            iterator_type;
  typedef iterator_value< BidiIter >::type    char_type;    
  typedef iterator_value< BidiIter >::type    value_type;   
  typedef unspecified                         string_type;  
  typedef regex_constants::syntax_option_type flag_type;    

  // construct/copy/destruct
  basic_regex();
  basic_regex(basic_regex< BidiIter > const &);
  template<typename Expr> basic_regex(Expr const &);
  basic_regex& operator=(basic_regex< BidiIter > const &);
  template<typename Expr> basic_regex& operator=(Expr const &);

  // public member functions
   BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                         ECMAScript = regex_constants::ECMAScript) ;
   BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                         icase = regex_constants::icase_) ;
   BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                         nosubs = regex_constants::nosubs) ;
   BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                         optimize = regex_constants::optimize) ;
   BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                         collate = regex_constants::collate) ;
   BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                         single_line = regex_constants::single_line) ;
   BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                         not_dot_null = regex_constants::not_dot_null) ;
   BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                         not_dot_newline = regex_constants::not_dot_newline) ;
   BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                         ignore_white_space = regex_constants::ignore_white_space) ;
  std::size_t mark_count() const;
  regex_id_type regex_id() const;
  void swap(basic_regex< BidiIter > &) ;

  // public static functions
  template<typename InputIter> 
    static basic_regex< BidiIter > 
    compile(InputIter, InputIter, flag_type = regex_constants::ECMAScript) ;
  template<typename InputRange> 
    static basic_regex< BidiIter > 
    compile(InputRange const &, flag_type = regex_constants::ECMAScript) ;
  static basic_regex< BidiIter > 
  compile(char_type const *, flag_type = regex_constants::ECMAScript) ;
  static basic_regex< BidiIter > 
  compile(char_type const *, std::size_t, flag_type) ;
};

Description

basic_regex public construct/copy/destruct

  1. basic_regex();

    Postconditions:

    regex_id() == 0

    mark_count() == 0

  2. basic_regex(basic_regex< BidiIter > const & that);

    Parameters:

    that

    The basic_regex object to copy.

    Postconditions:

    regex_id() == that.regex_id()

    mark_count() == that.mark_count()

  3. template<typename Expr> basic_regex(Expr const & expr);

    Construct from a static regular expression.

    Parameters:

    expr

    The static regular expression

    Requires:

    Expr is the type of a static regular expression.

    Postconditions:

    regex_id() != 0

    mark_count() >= 0

  4. basic_regex& operator=(basic_regex< BidiIter > const & that);

    Parameters:

    that

    The basic_regex object to copy.

    Postconditions:

    regex_id() == that.regex_id()

    mark_count() == that.mark_count()

    Returns:

    *this

  5. template<typename Expr> basic_regex& operator=(Expr const & expr);

    Construct from a static regular expression.

    Parameters:

    expr

    The static regular expression.

    Requires:

    Expr is the type of a static regular expression.

    Postconditions:

    regex_id() != 0

    mark_count() >= 0

    Returns:

    *this

    Throws:

    std::bad_alloc

basic_regex public member functions

  1.  BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                           ECMAScript = regex_constants::ECMAScript) ;
  2.  BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                           icase = regex_constants::icase_) ;
  3.  BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                           nosubs = regex_constants::nosubs) ;
  4.  BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                           optimize = regex_constants::optimize) ;
  5.  BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                           collate = regex_constants::collate) ;
  6.  BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                           single_line = regex_constants::single_line) ;
  7.  BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                           not_dot_null = regex_constants::not_dot_null) ;
  8.  BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                           not_dot_newline = regex_constants::not_dot_newline) ;
  9.  BOOST_STATIC_CONSTANT(regex_constants::syntax_option_type, 
                           ignore_white_space = regex_constants::ignore_white_space) ;
  10. std::size_t mark_count() const;

    Returns the count of capturing sub-expressions in this regular expression

  11. regex_id_type regex_id() const;

    Returns a token which uniquely identifies this regular expression.

  12. void swap(basic_regex< BidiIter > & that) ;

    Swaps the contents of this basic_regex object with another.

    Parameters:

    that

    The other basic_regex object.

    Throws:

    Will not throw.

    Notes:

    This is a shallow swap that does not do reference tracking. If you embed a basic_regex object by reference in another regular expression and then swap its contents with another basic_regex object, the change will not be visible to the enclosing regular expression. It is done this way to ensure that swap() cannot throw.

basic_regex public static functions

  1. template<typename InputIter> 
      static basic_regex< BidiIter > 
      compile(InputIter begin, InputIter end, 
              flag_type flags = regex_constants::ECMAScript) ;

    Factory method for building a regex object from a range of characters. Equivalent to regex_compiler< BidiIter >().compile(begin, end, flags);

    Parameters:

    begin

    The beginning of a range of characters representing the regular expression to compile.

    end

    The end of a range of characters representing the regular expression to compile.

    flags

    Optional bitmask that determines how the pat string is interpreted. (See syntax_option_type.)

    Requires:

    [begin,end) is a valid range.

    The range of characters specified by [begin,end) contains a valid string-based representation of a regular expression.

    Returns:

    A basic_regex object corresponding to the regular expression represented by the character range.

    Throws:

  2. template<typename InputRange> 
      static basic_regex< BidiIter > 
      compile(InputRange const & pat, 
              flag_type flags = regex_constants::ECMAScript) ;

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

  3. static basic_regex< BidiIter > 
    compile(char_type const * begin, 
            flag_type flags = regex_constants::ECMAScript) ;

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

  4. static basic_regex< BidiIter > 
    compile(char_type const * begin, std::size_t len, flag_type flags) ;

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


PrevUpHomeNext