Main Page | Class Hierarchy | Class List | File List | Class Members

RegEx Class Reference

#include <simpleregex.h>

List of all members.

Public Member Functions

 RegEx (const char *regex, int options=0)
 ~RegEx ()
int SubStrings (void) const
bool Search (const char *subject, int len=-1, int options=0)
bool SearchAgain (int options=0)
const char * Match (int i)


Detailed Description

PCRE adierazpen erregularrak erabiltzeko C++ wrapper bat da hau.


Constructor & Destructor Documentation

RegEx::RegEx const char *  regex,
int  options = 0
 

The constructor's first parameter is the regular expression the created object shall implement. Optional parameter options can be any combination of PCRE options accepted by pcre_compile(). If compiling the regular expression fails, an error message string is thrown as an exception.

Parameters:
regex Adierazpen erregularraren katea.
options Aukera gehigarriak.

RegEx::~RegEx  ) 
 

Metodo suntsitzailea.


Member Function Documentation

const char * RegEx::Match int  i  ) 
 

Method Match() returns a pointer to the matched substring specified with parameter i. Match() may only be called after a successful call to Search() or SearchAgain() and applies to that last Search()/SearchAgain() call. Parameter i must be less than SubStrings(). Match(-1) returns the last searched subject. Match(0) returns the match of the complete regular expression. Match(1) returns $1, etc.

Parameters:
i Zenbatgarren katea nahi dugun.
Returns:
i. katea.

bool RegEx::Search const char *  subject,
int  len = -1,
int  options = 0
 

Method Search() applies the regular expression to parameter subject. Optional parameter len can be used to pass the subject's length to Search(). If not specified (or less than 0), strlen() is used internally to determine the length. Parameter options can contain any combination of options PCRE_ANCHORED, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY. Search() returns true if a match is found.

Parameters:
subject Adierazpen erregularra aplikatuko diogun katea.
len Katearen luzera (hautazkoa).
options Aukera gehigarriak.
Returns:
True adierazpena betetzen bada, false bestela.

bool RegEx::SearchAgain int  options = 0  ) 
 

SearchAgain() again applies the regular expression to parameter subject last passed to a successful call of Search(). It returns true if a further match is found. Subsequent calls to SearchAgain() will find all matches in subject. Example:

if (Pattern.Search(astring)) { do { printf("%s\n", Pattern.Match()); } while (Pattern.SearchAgain()); }

Parameter options is interpreted as for method Search().

Parameters:
options Aukera gehigarriak.
Returns:
True adierazpena betetzen bada, false bestela.

int RegEx::SubStrings void   )  const [inline]
 

Method SubStrings() returns the number of substrings defined by the regular expression. The match of the entire expression is also considered a substring, so the return value will always be >= 1.

Returns:
Adierazpen erregularrak harrapatutako kate kopurua.


The documentation for this class was generated from the following files:
Generated on Tue Sep 11 12:08:00 2007 for libIXAml by doxygen 1.3.5