Compare a string with a compiled regular expression
#include <regex.h>
int regexec( const regex_t * preg,
const char * string,
size_t nmatch,
regmatch_t * pmatch,
int eflags );
BlackBerry 10.0.0
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The regexec() function compares string against the compiled regular expression preg. If regexec() finds a match it returns zero; otherwise, it returns nonzero.
The preg argument represents a compiled form of either a Basic Regular Expression or Extended Regular Expression. These classes are rigorously defined in IEEE P1003.2, Regular Expression Notation, and are summarized in the documentation for regcomp() .
The regexec() function records the matches in the pmatch array, with nmatch specifying the maximum number of matches to record. The regmatch_t structure is defined as:
typedef struct {
regoff_t rm_so;
regoff_t rm_eo;
} regmatch_t;
The members are:
The offsets in pmatch[0] identify the substring corresponding to the entire expression, while those in pmatch[1...nmatch] identify up to the first nmatch subexpressions. Unused elements of the pmatch array are set to -1.
See regcomp() .
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
Henry Spencer. For license information, see the Third Party License Terms List at http://www.qnx.com/licensing/third-party-terms/ .