Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
Public Member Functions | List of all members
CRegex Class Reference

Description

Factory class for regular expression matching.

This is basically a wrapper for regexp(3).

Definition at line 866 of file base.H.

#include "base.H"

Public Member Functions

bool SetPattern (const char *pattern, int cflags=REG_EXTENDED)
 Set and compile a search pattern. More...
 
bool Match (const char *s, int eflags=0, size_t maxMatches=0, regmatch_t *retMatchList=NULL)
 Perform a regular expression search. More...
 

Error handling ...

bool IsValid ()
 
const char * ErrorStr ()
 

Member Function Documentation

◆ SetPattern()

bool CRegex::SetPattern ( const char *  pattern,
int  cflags = REG_EXTENDED 
)

Set and compile a search pattern.

Parameters
patternThe pattern (or NULL to not match anything)
cflagsBit-wise OR of the following flags (see regexp(3)): REG_EXTENDED: Use POSIX Extended Regular Expression syntax REG_ICASE: Ignore case REG_NOSUB: Do not report position of matches REG_NEWLINE: Match-any-character operators don't match a newline
Returns
'true' on success, 'false' on failure

◆ Match()

bool CRegex::Match ( const char *  s,
int  eflags = 0,
size_t  maxMatches = 0,
regmatch_t *  retMatchList = NULL 
)

Perform a regular expression search.

Parameters
sThe string to be analysed
eflagsBit-wise OR of the following flags (see regexp(3)): REG_NOTBOL: The match-beginning-of-line operator always fails to match REG_NOTEOL: The match-end-of-line operator always fails
maxMatchesAt most this many matches are returned
retMatchListIf not NULL, the list of matches is written into *retMatchList (see regexp(3))
Returns
true if and only if the regular expression matched. If no pattern has been set before, false is returned.

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