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.
RegExp Struct Reference

The module used for performing regular expressions. More...

#include <regular_expressions.h>

Public Member Functions

RegExpAllocateRegExp (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...
 

Detailed Description

The module used for performing regular expressions.

Member Function Documentation

◆ AllocateRegExp()

RegExp * AllocateRegExp ( uint32  num_vectors)

Allocate a RegExp.

Parameters
num_vectorsThe maximum number of start and end indices of matching groups that the RegExp will be able to capture.
Returns
The newly-allocated RegExp or NULL upon error.

◆ FreeRegExp()

void FreeRegExp ( RegExp reg_ex_p)

Free a RegExp.

Parameters
reg_ex_pThe RegExp to free.

◆ ClearRegExp()

void ClearRegExp ( RegExp reg_ex_p)

Clear a RegExp ready to re-use with a different pattern.

Parameters
reg_ex_pThe RegExp to clear.

◆ SetPattern()

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.

Parameters
reg_ex_pThe RegExp to set the pattern for.
pattern_sThe pattern to set.
optionsThese 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.
Returns
true if the pattern was set successfully, false otherwise.

◆ MatchPattern()

bool MatchPattern ( RegExp reg_ex_p,
const char *  value_s 
)

Test whether a regular expression has any matches for a given value.

Parameters
reg_ex_pThe RegExp to use.
value_sThe value to test for matches.
Returns
true if there were any matches, false otherwise.

◆ GetNumberOfMatches()

uint32 GetNumberOfMatches ( const RegExp reg_ex_p)

Get the number of matchers after running MatchPattern().

Parameters
reg_ex_pThe RegExp to check.
Returns
The number of matches.

◆ GetNextMatch()

char * GetNextMatch ( RegExp reg_ex_p)

Get the next match from a regular expression.

Parameters
reg_ex_pThe RegExp to get the match from.
Returns
The next match or 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.

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