regex(3, 3ast) | regular expression interface |
regcomp, regerror, regexec, regfree, regex, regex_t, regmatch_t, regoff_t(3, 3type) | POSIX regex functions |
myr-regex, regex(3, REGEX) | myr-regex |
REGEX(3ast) | REGEX(3ast) |
regex - regular expression interface
#include <regex.h> int regcomp(regex_t* re, const char* regex, int cflags); int regexec(const regex_t* re, const char* string, size_t nmatch, regmatch_t pmatch[], int eflags); size_t regerror(int code, const regex_t* re, char* errbuf, size_t errbuf_size); void regfree(regex_t* re); regclass_t regclass(const char* str, char** end); int regaddclass(const char* name, regclass_t classf); int regcollate(const char* str, char** end, char* buf, int size); int regcomb(regex_t* re_1, regex_t* re_2); size_t regdecomp(regex_t* re, regflags_t flags, char* buf, size_t size); int regdup(regex_t* re_old, regex_t* re_new); regstat_t* regstat(const regex_t* re); regex_t* regcache(const char* pattern, regflags_t flags, int* pcode); int regncomp(regex_t* re, const char* pattern, size_t size, regflags_t flags); int regnexec(const regex_t* re, const char* subject, size_t size, size_t nmatch, regmatch_t* match, regflags_t flags); int regrecord(const regex_t* re); int regrexec(const regex_t* re, const char* buf, size_t size, size_t nmatch, regmatch_t* match, regflags_t flags, int sep, void* handle, regrecord_t recordf); void regfatal(regex_t* re, int level, int code); void regfatalpat(regex_t* re, int level, int code, const char* pattern); int regsubcomp(regex_t* re, const char* str, const regflags_t* map, int minmatch, regflags_t flags); int regsubexec(const regex_t* re, const char* subject, size_t nmatch, regmatch_t* match); int regsubflags(regex_t* re, const char* str, char** end, int delim, const regflags_t* map, int* pm, regflags_t* pf); void regsubfree(regex_t* re);
regcomp(), regexec(), regerror(), and regfree() are the POSIX regular expression functions. The remaining functions are AST extensions. AST also provides flags extensions to the regcomp(), regexec() functions and code extensions to the regerror() function.
regcache() maintains a cache of compiled regular expressions for patterns of size 255 bytes or less. The initial cache size is 8. pattern and flags are passed to regcomp() with an re pointer maintained by regcache(). pcode, if not 0, points to the return value of the regcomp() call. If the regcomp() call fails, regcache() returns 0 and pcode will point to the non-zero error code. Do not call regfree() on the re returned by regcache(). Both pattern and flags are used to match entries in the cache. When the cache is full the least recently used re is freed (via regfree()) to make space for the new pattern. Any re previously returned by regcache() may be freed (invalidated) on the next call to regcache(). If pattern is longer that 255 bytes then it is still passed on to regcomp(), but it will not be cached. If pattern is 0 then the cache is flushed. In addition, if the integer value of flags is greater than the current cache size, the cache size is increased to that integer value. 0 is always returned when pattern is 0; pcode will point to a non-zero value on error.
strmatch(3)
x86_64 |