Public Member Functions

base::Regex Class Reference

Regular expressions. More...

#include <libppbase/base/Regex.h>

List of all members.

Public Member Functions

 Regex ()
 Constructor, constructs an empty object.
 ~Regex ()
 Desctructor, frees regex resources.
void compile (const char *expression, int flags=0)
 Compiles a regular expression.
std::pair< int, int > getMatch (unsigned n)
 Gets information about a substring match.
bool match (const char *string, int flags=0, unsigned nmatch=0)
 Matches a string against a pre-compiled regular expression.

Detailed Description

Regular expressions.

Author:
Christoph Schwarz
Version:
$Id: Regex.h 21 2010-09-05 04:18:17Z cschwarz1 $

Member Function Documentation

void base::Regex::compile ( const char *  expression,
int  flags = 0 
)

Compiles a regular expression.

Parameters:
expression regular expression to compile
flags REG_ flags for regcomp, see regex(3)
Exceptions:
Exception on error
std::pair<int, int> base::Regex::getMatch ( unsigned  n  ) 

Gets information about a substring match.

A string must have been matched with the match() method and nmatch > 0

Parameters:
n the n-th substring match to get
Returns:
the starting (inclusive) and end (exclusive) offsets of the substring match
Exceptions:
Exception on error
bool base::Regex::match ( const char *  string,
int  flags = 0,
unsigned  nmatch = 0 
)

Matches a string against a pre-compiled regular expression.

The regular expression must have been compiled with the compile() method

Parameters:
string the string to match
flags REG_ flags for regexec, see regex(3)
nmatch number of structures to reserve for substring matches
Returns:
true if the string matches, false if not
Exceptions:
Exception on error

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