|
Home2L - C/C++ API v1.4-2-g83f4c (2025-08-23)
Smart Tools for a Private Home
|
Factory class for regular expression matching.
This is basically a wrapper for regexp(3).
#include "base.H"
Public Member Functions | |
| bool | SetPattern (const char *pattern, int cflags=REG_EXTENDED) |
| Set and compile a search pattern. | |
| bool | Match (const char *s, int eflags=0, size_t maxMatches=0, regmatch_t *retMatchList=NULL) |
| Perform a regular expression search. | |
| bool CRegex::SetPattern | ( | const char * | pattern, |
| int | cflags = REG_EXTENDED |
||
| ) |
Set and compile a search pattern.
| pattern | The pattern (or NULL to not match anything) |
| cflags | Bit-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 |
| bool CRegex::Match | ( | const char * | s, |
| int | eflags = 0, |
||
| size_t | maxMatches = 0, |
||
| regmatch_t * | retMatchList = NULL |
||
| ) |
Perform a regular expression search.
| s | The string to be analysed |
| eflags | Bit-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 |
| maxMatches | At most this many matches are returned |
| retMatchList | If not NULL, the list of matches is written into *retMatchList (see regexp(3)) |
true if and only if the regular expression matched. If no pattern has been set before, false is returned.