Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
|
The module used for performing regular expressions. More...
#include <regular_expressions.h>
Public Member Functions | |
RegExp * | AllocateRegExp (uint32 num_vectors) |
Allocate a RegExp. More... | |
void | FreeRegExp (RegExp *reg_ex_p) |
Free a RegExp. More... | |
void | ClearRegExp (RegExp *reg_ex_p) |
Clear a RegExp ready to re-use with a different pattern. More... | |
bool | SetPattern (RegExp *reg_ex_p, const char *pattern_s, int options) |
Set the pattern that a given RegExp will use for its regular expression. More... | |
bool | MatchPattern (RegExp *reg_ex_p, const char *value_s) |
Test whether a regular expression has any matches for a given value. More... | |
uint32 | GetNumberOfMatches (const RegExp *reg_ex_p) |
Get the number of matchers after running MatchPattern(). More... | |
char * | GetNextMatch (RegExp *reg_ex_p) |
Get the next match from a regular expression. More... | |
The module used for performing regular expressions.
RegExp * AllocateRegExp | ( | uint32 | num_vectors | ) |
void ClearRegExp | ( | RegExp * | reg_ex_p | ) |
bool SetPattern | ( | RegExp * | reg_ex_p, |
const char * | pattern_s, | ||
int | options | ||
) |
Set the pattern that a given RegExp will use for its regular expression.
reg_ex_p | The RegExp to set the pattern for. |
pattern_s | The pattern to set. |
options | These are the options that can be used by the underlying pcre engine. See http://www.pcre.org/original/doc/html/pcre_compile.html for more information. |
true
if the pattern was set successfully, false
otherwise. bool MatchPattern | ( | RegExp * | reg_ex_p, |
const char * | value_s | ||
) |
Test whether a regular expression has any matches for a given value.
reg_ex_p | The RegExp to use. |
value_s | The value to test for matches. |
true
if there were any matches, false
otherwise. uint32 GetNumberOfMatches | ( | const RegExp * | reg_ex_p | ) |
Get the number of matchers after running MatchPattern().
reg_ex_p | The RegExp to check. |
char * GetNextMatch | ( | RegExp * | reg_ex_p | ) |
Get the next match from a regular expression.
reg_ex_p | The RegExp to get the match from. |
NULL
if there are no more. If a non-NULL
value is returned, it will need to be freed with FreeCopiedString() to avoid a memory leak.