Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

RE Class Reference

Regex wrapper class. More...

#include <RE.h>

List of all members.

Public Methods

 RE (const string &pattern)
 Constructor. More...

 ~RE ()
bool match (const string &s)
string get_matched (const int i)
const int* get_span (const int i)
int get_nsub ()
 return number of subexpressions in the expression. More...


Detailed Description

Regex wrapper class.


Constructor & Destructor Documentation

RE::RE ( const string & pattern )
 

Constructor.

Compile the given "pattern"(a regular expression) into internal form for matches which will be performed later on.

RE::~RE ( )
 


Member Function Documentation

string RE::get_matched ( const int i )
 

Get i-th matched substring.

Parameters:
i   The index of substring to get.
Returns:
i-th substring

Calling this after a failed match will cause GetError exception. Out-of-range error detected and GetError will be thrown.

int RE::get_nsub ( )
 

return number of subexpressions in the expression.

const int * RE::get_span ( const int i )
 

Get the start and end index of i-th substring relative to the whole string.

Parameters:
i   The index of target substring.
Returns:
Array(pair) of integers. First one is the start index, and second one, the end index. The values in the array will be updated after another get_span() call.

bool RE::match ( const string & s )
 

Match given string "s" with the compiled expression. "True" is returned for "match success", "false" for "match failed." The exception MatchError doesn't mean "match failed."


The documentation for this class was generated from the following file:
Generated at Wed Jul 3 14:55:42 2002 for Annotation Graph API by doxygen1.2.7 written by Dimitri van Heesch, © 1997-2001