ldas-tools-al 2.6.4
Public Member Functions | List of all members
RegexMatch Class Reference

Regular Expression Match. More...

#include <regexmatch.hh>

Public Member Functions

 RegexMatch (off_type nmatches=0)
 Constructor. More...
 
 ~RegexMatch ()
 Destructor.
 
bool match (const Regex &r, const char *string, flag_type eflags=0)
 Perform a Regex Match. More...
 
off_type capacity () const
 
off_type size () const
 
bool isSubValid (off_type m)
 Check Substring Match Validity. More...
 
const char * getSubStart (off_type m)
 Get Substring Start. More...
 
const char * getSubEnd (off_type m)
 Get Substring End. More...
 
int getSubStartOffset (off_type m)
 Get Substring Starting Offset. More...
 
int getSubEndOffset (off_type m)
 Get Substring Ending Offset. More...
 
off_type getSubLength (off_type m)
 Get Substring Length. More...
 
std::string getSubString (off_type m)
 Get Substring. More...
 
off_type getNMatches () const
 Get Number of Matches. More...
 

Detailed Description

Regular Expression Match.

This class represents a regular expression match. It attempts to match a string with a regular expression, storing the information resulting from captures (the parenthesis expressions).

Constructor & Destructor Documentation

◆ RegexMatch()

RegexMatch::RegexMatch ( off_type  nmatches = 0)

Constructor.

Parameters
nmatches

Member Function Documentation

◆ capacity()

RegexMatch::off_type RegexMatch::capacity ( ) const
inline

Returns the maximum number of matches which this object can hold. This is equal to the number of matches which was passed to the constructor.

Returns
off_type

◆ getNMatches()

RegexMatch::off_type RegexMatch::getNMatches ( ) const
inline

Get Number of Matches.

Returns the maximum number of matches which this object can hold. This is equal to the number of matches which was passed to the constructor.

Returns
off_type

◆ getSubEnd()

const char * RegexMatch::getSubEnd ( off_type  m)
inline

Get Substring End.

Returns a pointer to the end of a substring match. If the requested match is not valid, a null pointer is returned.

Parameters
m
Returns
const char*

◆ getSubEndOffset()

int RegexMatch::getSubEndOffset ( off_type  m)
inline

Get Substring Ending Offset.

Returns the offset to the end of a substring match. If the requested match is not valid, then -1 is returned.

Parameters
m
Returns
const char*

◆ getSubLength()

RegexMatch::off_type RegexMatch::getSubLength ( off_type  m)
inline

Get Substring Length.

Returns the number of characters in a substring match.

Parameters
m
Returns
off_type

◆ getSubStart()

const char * RegexMatch::getSubStart ( off_type  m)
inline

Get Substring Start.

Returns a pointer to the beginning of a substring match. If the requested match is not valid, a null pointer is returned.

Parameters
m
Returns
const char*

◆ getSubStartOffset()

int RegexMatch::getSubStartOffset ( off_type  m)
inline

Get Substring Starting Offset.

Returns the offset to the beginning of a substring match. If the requested match is not valid, then -1 is returned.

Parameters
m
Returns
const char*

◆ getSubString()

std::string RegexMatch::getSubString ( off_type  m)

Get Substring.

Return a substring as a C++ string object.

Parameters
mIndex of match starting from zero.
Returns
std::string - Value of the match if m is within the number of
  • matches, the empty string otherwise.

◆ isSubValid()

bool RegexMatch::isSubValid ( off_type  m)
inline

Check Substring Match Validity.

This returns whether or not a substring match exists at the specified index.

Parameters
m
Returns
bool

◆ match()

bool RegexMatch::match ( const Regex r,
const char *  string,
flag_type  eflags = 0 
)

Perform a Regex Match.

Parameters
rPrecompiled pattern buffer
stringText string containing the input text
eflagsflag which cause changes in matching behavior
  • (see: man regexec).
Returns
bool true if match was found, false otherwise

◆ size()

RegexMatch::off_type RegexMatch::size ( ) const
inline

Returns the number of matches that were found after the call to match()

Returns
off_type

The documentation for this class was generated from the following files: