|
Aegis
4.25.D505
|
#include <regula_expre.h>
Public Member Functions | |
| virtual | ~regular_expression () |
| regular_expression (const nstring &pattern, bool icase=false) | |
| bool | matches (const char *text, size_t &so, size_t &eo) |
| bool | match (const nstring &arg, size_t offset=0) |
| const char * | strerror () const |
| bool | match_and_substitute (const nstring &rhs, const nstring &actual, long how_many_times, nstring &output) |
Private Member Functions | |
| void | set_error (int err) |
| bool | compile () |
| regular_expression () | |
| regular_expression (const regular_expression &) | |
| regular_expression & | operator= (const regular_expression &) |
Private Attributes | |
| nstring | errstr |
| nstring | lhs |
| bool | icase |
| bool | compiled |
| regex_t | preg |
| regmatch_t | regmatch [10] |
The regular_expression class is used to represent the state of a regular expression match. All of the interfacing with the regex code is taken care of by this class.
You can match the one pattern against numerous strings by making repeated calls to the match() method.
You can match against a string, and replace it with something else, by using the match_and_substitute method. It, too, may be called more than once.
Definition at line 38 of file regula_expre.h.
| virtual regular_expression::~regular_expression | ( | ) | [virtual] |
The destructor.
| regular_expression::regular_expression | ( | const nstring & | pattern, |
| bool | icase = false |
||
| ) |
The constructor.
| pattern | The pattern to be matched against. |
| icase | true for case-insensitive match, the default is case sensitive |
| regular_expression::regular_expression | ( | ) | [private] |
The default constructor. Do not use.
| regular_expression::regular_expression | ( | const regular_expression & | ) | [private] |
The copy constructor. Do not use.
| bool regular_expression::compile | ( | ) | [private] |
The compile method is used to compile the left and side of the regular expression match. Compilation is deferred until the regular expression is actually used.
| bool regular_expression::match | ( | const nstring & | arg, |
| size_t | offset = 0 |
||
| ) |
The match method is used to match a string against the pattern given to the constructor.
| arg | The string to be matched against the pattern. |
| offset | The point at which to start searching in the string; defaults to zero, meaning the start of the string. |
| bool regular_expression::match_and_substitute | ( | const nstring & | rhs, |
| const nstring & | actual, | ||
| long | how_many_times, | ||
| nstring & | output | ||
| ) |
The match_and_substitute method is used to match the left hand side of a regular expression and substitute the right hand side if there was a match
| rhs | The right-hand-side pattern for substituting. |
| actual | The text to be matched, possibly more than once. |
| how_many_times | The maximum number of times to perform the match; zero means unlimited. |
| output | The result of the substitution is placed here. |
| bool regular_expression::matches | ( | const char * | text, |
| size_t & | so, | ||
| size_t & | eo | ||
| ) |
The matches method is used to match a string against the pattern given to the constructor.
| text | The string to be matched against the pattern. |
| so | The start offset of the match (on success) |
| eo | The end offset of the match (on success) |
| regular_expression& regular_expression::operator= | ( | const regular_expression & | ) | [private] |
The assignment operator. Do not use.
| void regular_expression::set_error | ( | int | err | ) | [private] |
The set_error method is used to obtain the text of the error for the last regex function call, and set the errstr instance variable accordingly.
| err | The error code returned by the last regex call. |
| const char* regular_expression::strerror | ( | ) | const |
Obtain an human readable representation of the most recent error, or NULL if there has been no error.
bool regular_expression::compiled [private] |
The compiled instance variable is used to remember whether or not the left hand side has been compiled yet.
Definition at line 156 of file regula_expre.h.
nstring regular_expression::errstr [private] |
The errstr instance variable is used to remember the human readable text of the last error which ocurred.
Definition at line 121 of file regula_expre.h.
bool regular_expression::icase [private] |
The icase instance variable is sud to remeber whether we are doing a case-sensitive match (false) or a case-IN-sensitive match (true).
Definition at line 143 of file regula_expre.h.
nstring regular_expression::lhs [private] |
The lhs instance variable is used to remember the pattern on the left hand side to be matched against.
Definition at line 137 of file regula_expre.h.
regex_t regular_expression::preg [private] |
The preg instance variable is an opaque storage area used by the regex functions. It is initialised by the compile() method.
Definition at line 162 of file regula_expre.h.
regmatch_t regular_expression::regmatch[10] [private] |
The regmatch instance variable is used to remember the matching postions from the last match() method call.
Definition at line 168 of file regula_expre.h.
1.7.6.1