cxxtools::Regex Class Reference

regex(3)-wrapper. More...

#include <cxxtools/regex.h>

Public Member Functions

 Regex ()
 create a uninitialized regex object.
 Regex (const char *ex, int cflags=REG_EXTENDED)
 create a regex object with a const char*.
 Regex (const std::string &ex, int cflags=REG_EXTENDED)
 create a regex object with std::string.
bool matchp (const std::string &str_, std::string::size_type p, RegexSMatch &smatch, int eflags=0) const
 Returns true if str starting from p matches the regular expression. The matches are decribed in the smatch object.
bool matchp (const std::string &str_, std::string::size_type p, int eflags=0) const
 Returns true if str starting from p matches the regular expression.
bool match (const std::string &str_, RegexSMatch &smatch, int eflags=0) const
 Returns true if str matches the regular expression. The matches are decribed in the smatch object.
bool match (const std::string &str_, int eflags=0) const
 Returns true if str matches the regular expression.
std::string subst (const std::string &str, const std::string &expr, bool all=true)
 Replaces occurence of the regular expression in str with expr.
void free ()
 Destroys the regular expression. This is normally done by the destructor.
bool empty () const
 Returns true, if the object does not have a valid regular expression.

Detailed Description

regex(3)-wrapper.

Constructor & Destructor Documentation

cxxtools::Regex::Regex ( )
inline

create a uninitialized regex object.

cxxtools::Regex::Regex ( const char *  ex,
int  cflags = REG_EXTENDED 
)
inlineexplicit

create a regex object with a const char*.

cxxtools::Regex::Regex ( const std::string &  ex,
int  cflags = REG_EXTENDED 
)
inlineexplicit

create a regex object with std::string.

Member Function Documentation

bool cxxtools::Regex::empty ( ) const
inline

Returns true, if the object does not have a valid regular expression.

void cxxtools::Regex::free ( )
inline

Destroys the regular expression. This is normally done by the destructor.

bool cxxtools::Regex::match ( const std::string &  str_,
RegexSMatch smatch,
int  eflags = 0 
) const
inline

Returns true if str matches the regular expression. The matches are decribed in the smatch object.

bool cxxtools::Regex::match ( const std::string &  str_,
int  eflags = 0 
) const
inline

Returns true if str matches the regular expression.

bool cxxtools::Regex::matchp ( const std::string &  str_,
std::string::size_type  p,
RegexSMatch smatch,
int  eflags = 0 
) const

Returns true if str starting from p matches the regular expression. The matches are decribed in the smatch object.

bool cxxtools::Regex::matchp ( const std::string &  str_,
std::string::size_type  p,
int  eflags = 0 
) const

Returns true if str starting from p matches the regular expression.

std::string cxxtools::Regex::subst ( const std::string &  str,
const std::string &  expr,
bool  all = true 
)

Replaces occurence of the regular expression in str with expr.

The expr is expanded using RegexSMatch::format. If the 3rd parameter is true, all occurences are replaced.


The documentation for this class was generated from the following file: