Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct template regex_compiler

boost::xpressive::regex_compiler — Class template regex_compiler is a factory for building basic_regex objects from a string.

Synopsis

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

template<typename BidiIter, typename RegexTraits, typename CompilerTraits> 
struct regex_compiler {
  // types
  typedef                             ;  
  typedef     ;      
  typedef  ;      
  typedef                          ;    
  typedef             ;    
  typedef             ;    
  typedef         ;

  // construct/copy/destruct
  ( = );

  // public member functions
   ();
   () ;
  template<typename InputIter> 
    basic_regex<  
    (, ,  = );
  template<typename InputRange> 
    basic_regex<  
    (,  = );
  basic_regex<  
  (,  = );
  basic_regex<  (, , );
  basic_regex<  ();
  basic_regex<  () ;

  // private member functions
   () ;
};

Description

Class template regex_compiler is used to construct a basic_regex object from a string. The string should contain a valid regular expression. You can imbue a regex_compiler object with a locale, after which all basic_regex objects created with that regex_compiler object will use that locale. After creating a regex_compiler object, and optionally imbueing it with a locale, you can call the compile() method to construct a basic_regex object, passing it the string representing the regular expression. You can call compile() multiple times on the same regex_compiler object. Two basic_regex objects compiled from the same string will have different regex_id's.

regex_compiler public construct/copy/destruct

  1. ( traits = );

regex_compiler public member functions

  1.  ( loc);

    Specify the locale to be used by a regex_compiler.

    Parameters:

    loc

    The locale that this regex_compiler should use.

    Returns:

    The previous locale.

  2.  () ;

    Get the locale used by a regex_compiler.

    Returns:

    The locale used by this regex_compiler.

  3. template<typename InputIter> 
      basic_regex<  
      ( begin,  end,  flags = );

    Builds a basic_regex object from a range of characters.

    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:

    InputIter is a model of the InputIterator concept.

    Requires:

    [begin,end) is a valid range.

    Requires:

    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:

    regex_error when the range of characters has invalid regular expression syntax.
  4. template<typename InputRange> 
      basic_regex<  
      ( pat,  flags = );

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

  5. basic_regex<  
    ( begin,  flags = );

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

  6. basic_regex<  
    ( begin,  size,  flags);

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

  7. basic_regex<  ( name);

    Return a reference to the named regular expression. If no such named regular expression exists, create a new regular expression and return a reference to it.

    Parameters:

    name

    A std::string containing the name of the regular expression.

    Requires:

    The string is not empty.

    Throws:

    bad_alloc on allocation failure.
  8. basic_regex<  ( name) ;

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

regex_compiler private member functions

  1.  ( ch) ;

PrevUpHomeNext